In 1917, Cheng Fangwu and his friends were openly anti-Japan; yet in Japan they were free to elect whatever major they liked. Cheng studied steel making, guns, ballistics and torpedoes but later decided that military science was not going to save his country because his countrymen were still in "a deep slumber" - indifferent to military defeat and territorial loss. Cheng and his friends later abandoned their pursuits in science and embarked on the new culture movement.
To take one example, there was a military school in Japan for Chinese students called the Tokyo Shinbu Gakko. It was established early in the 20th century and run by the Japanese Army under the auspices of the "Pan Asian" Faction of the Japanese government. One of its most famous graduates was Chiang Kai Shek, who later led the anti-Japanese resistance. But some other graduates became pro-Japanese collaborators during World War II, so the effort was not entirely wasted.
Japan at the time wanted to "dominate" China, but not necessarily "conquer" China. Some in Japan thought that the best way was to cultivate future Chinese leaders that would be sympathetic to Japan. Even during World War II, Japan tried to work with local leaders in parts of Southeast Asia, with varying success; before and during World War I, that policy was also pursued with regards to China.
In the first decade or two of the 20th century, Japan's most feared enemy was Russia. Cultivating Chinese (and other Asian) leaders was seen as creating a counterweight to this enemy. A large part of this payoff was received in the form of Chinese logistical support during the Russo-Japanese War of 1904-05.