Joyce and his family spent the years of World War I in Zürich, where he finished his novel A Portrait of the Artist as a Young Man. It first appeared in The Egoist, a periodical edited by Harriet Shaw Weaver, and was published in book form in 1916. In 1917, Joyce contracted glaucoma; for the rest of his life he would endure pain, periods of near blindness, and many operations. At this time he also wrote his only play, the Ibsenesque Exiles (1918).
Ulysses, written between 1914 and 1921, was published in parts in The Little Review and The Egoist, but Joyce encountered the same opposition to publishing the novel in book form that he had confronted with Dubliners. It was published in Paris in 1922 by Shakespeare & Company, a bookstore owned by Sylvia Beach, an American expatriate. Its publication was banned in the United States until 1933. For many years he lived mainly on money donated by patrons, notably Harriet Shaw Weaver.