What makes it appear to me that Japan modernised to come to a level of advancement comparable to Western powers was, unlike Ottoman Empire
- Japan had universal compulsory education
- the level of penetration of technology in governance and commerce.
- Japan's power projection in late 1800's and early 1900's.
It was able to throw its weight around in 1905 against Russia, and had become the third naval power in the world before 1930.
While the Ottoman Empire did not have widespread industrial development, and had regions as undeveloped as Arabia.
It was when Ataturk came to power that modernisation of Turkey began, I'd say.
Was it because Ottoman Empire was eclipsed by the West gradually, and didn't see the importance of modernising; compared to Japan, which was raised from its sleep abruptly?
For arguably, the Ottoman empire had more resources at its command, and had a functioning bureaucracy, unlike Japan, which was feudalistic and had to undergo a process of centralisation. It was in continued contact with the West, and with the ideas and innovations. The defeats during Napoleon's expeditions should have been an alarm bell for them.
Was it because the threat to them wasn't existential, as they were extended protection and propping up by France and Britain? Unlike Japan, which had witnessed the Opium Wars and was more anxious.
A quote from 1912s
Our habit was to keep our hands free, though we made ententes and friendships. It was true that we had an alliance with Japan, but it was limited to certain distant questions in the Far East.[a] The [Ottoman delegate] replied that Empire was the Japan of the Near East (alluding to Meiji Restoration period which spanned from 1868 to 1912), and that we already had the Cyprus Convention which was still in force.
-1st Viscount Grey of Fallodon