In the 7th century, the Tang dynasty of China and the Yamato dynasty of Japan fought a series of wars over control of the Korean peninsula. The conflict ultimately ended in a stalemate, with the two countries agreeing to a peace treaty in 668 AD.
In the 13th century, the Yuan dynasty of China invaded Japan twice, in 1274 and 1281. Both invasions were unsuccessful, and the Yuan forces were eventually repelled.
The most recent conflict between Japan and China was the Second Sino-Japanese War, which lasted from 1937 to 1945. The war was a brutal struggle that resulted in the deaths of millions of people. The war ended with the defeat of Japan and the surrender of its forces to the Allies.