China and Japan had actually fought 2 wars. The first war between them was commonly known as the Chinese-Japanese War and was fought in the years of 1894-1895. The second war, which is referred to as the Sino-Japanese War began in 1937, however it was absorbed into World War 2.
The First War
The first war was fought over control over Korea, which was originally a vassal state of China. In 1894, an uprising broke out in Korea so Chinese troops were sent in to suppress it. Since 1876 Korea’s ports were open to Japan, to protects its interests in Korea, Japan also sent troops when the uprising had broken out. However once the uprising had been put down, Japanese troops refused to leave the island. In July 1884, fighting broke out between Japanese and Chinese troops. Japan emerged as the obvious victor as they had crushed the Chinese Navy. On the 17th of April, 1895 a peace treaty was signed, for an independent Korea. However an independent Korea only lasted until 1910, when the Japanese took over, again. Although the first Sino-Japanese War was relatively brief it had seriously weakened China.
The Second War
The second war between China and Japan started in 1937 when Japan (after taking Manchuria and the Jehol Province from China) attacked China, again. At that time in China, there was internal conflict between nationalist and communist parties, eventually China turned its attention to the foreign aggressor that had attacked them. China and Japan fought until 1941 before war was officially declared by China. However China had just made a big mistake, declaring war with Japan, meant that they not only had to fight Japan but Germany and Italy, as Japan was allied with them in World War 2. Therefore the conflict had become part of World War 2. The second Chinese-Japanese war ended with the surrender of Japan in September in 1945.