As this question implies, both Japan and China were not modern nations about 150 years ago. Since then, both have modernized. There has been one major similarity in the way they both rose. The major similarity is that both rose, in part, through industrializing and exporting. Their rises are also similar in that both were, to some extent, state-directed.
In both China and Japan, as with many developing countries, growth came about largely through industrializing and exporting to the richer world. China’s rise has been recent and is well-known. China became a modern country largely by manufacturing goods to be sold to the West. The same was true of Japan. For example, in the Meiji Era, Japan’s economy was based largely on industrialized production of textiles. Japan was particularly involved in industrialized production of silk. By the 1880s, Japan had a trade surplus. In both countries, this export-led growth was promoted by heavy government involvement. In Japan, for example, the private sector lacked the means to compete with the West so the government stepped in to do things like providing loans and even building factories for private industry.
While China and Japan did have this in common, there were important differences in how they transitioned to the modern world. Perhaps the most important difference is that Japan made its transition first. This has strongly affected the difference between the positions of the two countries in the modern world. Japan made its transition about 100 years before China did. Because of that, Japan is now one of the richest countries in the world. China, by contrast, has a huge economy, but is still only reaching middle income in terms of GDP per capita.
A second major difference is that Japan’s transition was made at a time when the international order was much less settled. Japan made its rise in part through war. Its defeat of Russia in 1905 was a major step in its modernization. Japan modernized, in part, through creating a small empire for itself. China, by contrast, has modernized at a time when the international order no longer allows such things to happen. This difference had a huge impact on the trajectories of the two countries’ rises. Japan rose dramatically, only to fall when its imperial ambitions set off WWII in the Pacific. Japan is, as a consequence, no longer a major military power in the world. Rising in a different time period, China has not had to become a major military power in that it has not had to try to challenge any dominant countries militarily.
A third major difference is that Japan transitioned to the modern world as a largely capitalist economy with a more or less democratic form of government. China is trying to make the transition with a more hybrid economy and a decidedly non-democratic government. This, too, has affected their places in the world. It has arguably helped to make Japan richer than China and has also made Japan a country with a better reputation around the world.
It is hard to know what China will become by the time it has been modern for as long as Japan has been. It will be interesting to see if China comes to resemble Japan much more than it does today.