Huan Wen 桓溫 (312-373), courtesy name Yuanzi 元子, was a famous general of the Eastern Jin period 東晉 (317-420). He hailed from Longkang 龍亢 in the princedom of Qiao 譙 (close to present-day Huaiyuan 懷遠, Anhui) and was married with Emperor Ming's 晉明帝 (r. 313-316) daughter Princess Nankang 南康公主. In his status, he was Commandant of the escort (fuma duwei 駙馬都尉).
Huan is most famous for this three military campaigns which aimed at reconquering northern China that had been lost to various non-Chinese invaders in the early 4th century (see Sixteen Barbarian States 五胡十六國, 300~430). His military successes made him hopeful enough to make plans to replace Emperor Jianwen 晉簡文帝 (r. 371-372) and found a dynasty of its own.
The forerunners of Huan Wen in military matters were Zu Ti 祖逖 (266-321), and the brothers Yu Liang 庾亮 (289-340) and Yu Yi 庾翼 (305-345), who all advocated the reconquest of the north, but were outvoted by other courtiers.
In 345, Yu Yi, at that time commander over Wuchang 武昌 (today's Echeng 鄂城, Hubei), died, and Huan Wen was given the title of General appeasing the west (anxi jiangjun 安西將軍) and was made temporary commander (jiajie dudu 假節都督) of central China. As regional inspector (cishi 刺史) of the province of Jingzhou 荊州, he took the chance to attack the empire of Cheng-Han 成漢 (304-347) in the Sichuan Basin whose government was apparently unstable and impotent. After two years of campaigning his troops conquered the Sichuan Basin. The emperor thereupon bestowed on him the title of General-in-chief conquering the west (zhengxi da jiangjun 征西大將軍) and made him Commandery Duke of Linhe 臨賀郡公.
Another occasion for reconquest was made up in 349, when Shi Hu 石虎, ruler of the Later Zhao dynasty 後趙 (319-350), died. Huan Wen several times memorialized to the throne to allow him carrying out an attack. A year later, the court appointed Yin Hao 殷浩 (d. 356), the regional inspector of Yangzhou 揚州, general of the central army (zhongjun jiangjun 中軍將軍) and gave in his hands the commands over the troops of the provinces of Yangzhou, Yuzhou 豫州, Xuzhou 徐州, Yanzhou 兗州, and Qingzhou 青州. Yin Hao was entrusted with the northern campaigns. In this way, the court hoped to balance the power between the two generals. Yet Yin Hao was defeated in 354 and demoted to the status of commoner. Huan Wen remained the sole powerful military figure of the Jin empire, bearing since 362 the prestigious title of Defender-in-chief (taiwei 太尉).
In the second month of 354, Huan set off from Jiangling 江陵 with 40,000 infantry and cavalry men which marched through Xixian 析縣 (today's Xixia 西峽, Henan) to Wuguan 武關 (Danfeng 丹鳳, Shaanxi). At the same time a fleet started in Xiangyang 襄陽 (today in Hubei), entered Junkou 均口 (Danjiangkou 丹江口, Hubei) and advanced to Nanxiang 南鄉 (Junxian 均縣, Hubei). Sima Xun 司馬勳 (d. 266), the regional inspector of the province of Liangzhou 梁州, advanced along the Ziwu Canal 子午道 in the Hanzhong region 漢中. An advance party occupied Shangluo 上洛 (Shangxian 商縣, Shaanxi) southwest of Chang'an 長安 (Xi'an 西安, Shaanxi). In the fourth lunar month, Huan Wen met a large army of the Former Qin empire 前秦 (351-394) in the battle of Lantian 藍田 (Shaanxi). He won and advanced until Bashang 灞上 close to Chang'an. The ruler of the Former Qin, Fu Jian 苻健 (r. 351-354), made preparations to defend the city. His most important precaution was to harvest the early grain, so that the invader had no supplies left. In the sixth lunar month therefore, Huan Wen was forced to withdraw.
In late summer of 356, Huan Wen set off for his second campaign. He defeated the Qiang 羌 leader Yao Xiang 姚襄 (c. 331-357) at the banks of River Yi 伊水 and conquered Luoyang 洛陽 (today in Henan), but soon withdrew and only left a contingent of 2,000 for the protection of the city.
In the next years, the cities of Yingchuan 潁川, Qiao 譙 and Pei沛 were occupied by the Former Yan empire 前燕 (337-370).
Huan Wen was in 360 promoted to the status of Duke of Nanjun 南郡公. In 362, he suggested to transfer the imperial seat back to Luoyang and to resettle northern refugees in their original lands. The discourse about this matter, and the dissatisfaction of the southern gentry with the continuing influx of refugees from the north led to a paralysis of the Jin central government. In this occasion, the empire of Northern Yan used her chance and in 365 took Luoyang.
In 363, Huan Wei was given the title of Commander-in-chief (da sima 大司馬) and was thus the head of all imperial armies (dudu zhongwai zhujun shi 都督中外諸軍事). He was palace attendant (shizhong 侍中) and supervisor of the imperial secretaries (lu shangshu shi 錄尚書事), bearer of the golden axe (jia huangyue 假黃鉞) and thus virtually a direct representative of the throne.
A year later, he was made regional governor (mu 牧) of Yangzhou, and in 369, regional inspector of Xuzhou and Yanzhou. The defense of the provinces of Jingzhou and Yangzhou was in the hands of Huan Wen. Yet his aspirations were higher, and a further military campaign would enlarge his power. In early summer 369, he advanced with 50,000 infantry and cavalry from Gushu 姑孰 (Dangtu 當涂, Anhui) to Jinxiang 金鄉 (today in Shandong). He then ordered Mao Husheng 毛虎生 (dates unknown), General carrying on the [commander's] cap (yiguan jiangjun 遣冠軍將), to march through Juye 鉅野 (Juye 巨野, Shandong) and along River Wen 汶水, so that the two parties met at the banks of River Qingshui 清水, where the whole army boarded and was shipped northwards along the Yellow River.
In late summer, the army arrived in Fangtou 枋頭 (Jinxian 汲縣, Henan), just 200 li 里 (c. 100 km) from Ye 鄴 (Linzhang 臨漳, Hebei), the capital of the Yan empire. The ruler of the Yan first wanted to flee to Longcheng 龍城 (Chaoyang 朝陽, Liaoning) in the north, and to ask the Former Qin for support. The city of Ye was defended by Murong Chui 慕容垂 (326-396) with an army of 50,000. As before, when Huan Wen had advanced to Chang'an, he also hesitated this time instead of charging an attack against Murong Chui. When the army ran out of supplies, he had to withdraw, this time without boats, because the water levels of all rivers were too low after several months of draught. The exhausted army threw away their loads, helmets and weapons, and marched back all the way. Murong Chui, for his part, attacked the retreating Jin troops from two sided and killed more than 30,000 men in the battle of Xiangyi 襄邑 (Suixian 睢縣, Henan). A further loss of 10,000 men was inflicted at Qiao 譙, when the relief army of Former Qin attacked the rest of Huan Wen's army.
In 371, Huan Wen deposed Emperor Sima Yi 司馬奕 (therefore known as the Deposed Emperor 晉廢帝, r. 365-371) and made him Prince of Donghai 東海王 (Duke of Donghai 海西公), and instead enthroned Prince Sima Yu 司馬昱 (known as Emperor Jianwen). Huan himself was Counsellor-in-chief (chengxiang 丞相) and regent and held the title of Commander-in-chief. Only two years later, Emperor Jianwen died, and Huan Wen requested to be granted the use of the nine privileges (jia jiuxi 加九錫), namely state coach, robes, own guards (huben 虎賁), musical instruments, low-stair procession halls (nabi 納陛), red-varnished doors (zhuhu 朱户), bow and arrows, ceremonial axes (fuyue 斧钺), and ceremonial wine (juchang 秬鬯), but he soon fell ill and died. The command over his troops was given into the hands of his younger brother Huan Chong 桓沖 (328-384).