Admitted to the Charles-Ferdinand University of Prague, Kafka first studied chemistry, but switched after two weeks to law. This offered a range of career possibilities, which pleased his father, and required a longer course of study that gave Kafka time to take classes in German studies and art history. At the university, he joined a student club, named Lese-und Redehalle der Deutschen Studenten, which organized literary events, readings and other activities. In the end of his first year of studies, he met Max Brod, who would become a close friend of his throughout his life, together with the journalist Felix Weltsch, who also studied law. Kafka obtained the degree of Doctor of Law on 18 June 1906 and performed an obligatory year of unpaid service as law clerk for the civil and criminal courts.
On 1 November 1907, he was hired at the Assicurazioni Generali, a large Italian insurance company, where he worked for nearly a year. On 15 July 1908, he resigned, and two weeks later found more congenial employment with the Worker's Accident Insurance Institute for the Kingdom of Bohemia. The job involved investigating personal injury to industrial workers, and assessing compensation. He was also given the task of compiling and composing the annual report and was reportedly quite proud of the results, sending copies to friends and family. In parallel, Kafka was also committed to his literary work.
In 1911, Karl Hermann, spouse of his sister Elli, asked Kafka to collaborate in the operation of an asbestos factory known as Prager Asbestwerke Hermann and Co. Kafka showed a positive attitude at first, dedicating much of his free time to the business. During that period, he also found interest and entertainment in the performances of Yiddish theatre, despite the misgivings of even close friends such as Max Brod, who usually supported him in everything else.
In 1912, at Max Brod's home, Kafka met Felice Bauer, who lived in Berlin and worked as a representative for a dictaphone company. Over the next five years they corresponded a great deal, met occasionally, and twice were engaged to be married. Their relationship finally ended in 1917.
In 1917, Kafka began to suffer from tuberculosis, which would require frequent convalescence during which he was supported by his family, most notably his sister Ottla.
From 1920 Kafka developed an intense relationship with Czech journalist and writer Milena Jesenská. In July 1923, throughout a vacation to Graal-Müritz on the Baltic Sea, he met Dora Diamant and briefly moved to Berlin in the hope of distancing himself from his family's influence to concentrate on his writing. In Berlin, he lived with Diamant, a 25-year-old kindergarten teacher from an orthodox Jewish family, who was independent enough to have escaped her past in the ghetto.
Kafka's tuberculosis worsened in spite of using naturopathic treatments; he returned to Prague, then went to Dr. Hoffmann's sanatorium in Kierling near Vienna for treatment, where he died on 3 June 1924, apparently from starvation. His body was ultimately brought back to Prague where he was buried on 11 June 1924, in the New Jewish Cemetery in Prague-Žižkov.
When Kafka died he requested that his friend Max Brod destroy any of his unpublished works, writing: "Dearest Max, My last request: Everything I leave behind me [is] to be burned unread." However Brod ignored this and instead published The Trial, Amerika and The Castle.