His father died when he was 3, his mother when he was 14. In 1774, at age 17, he started studies at Lund University and produced two dissertations within two years, but was expelled just before presenting the second one. In 1776 he joined a ship of the Swedish East India Company from Gothenburg to China, but fled in Cape Town in April and in September he enlisted as a student of the University of Greifswald, which then was situated in Swedish Pomerania. There he wrote a dissertation on the justification of the American declaration of independence, but was told this subject was too sensitive, because of Sweden's diplomatic relation with Great Britain.