One simple answer is that Japan lacked the raw materials/goods that made e.g. China such an attractive target for the European colonial Powers. It was (and still is) a small, resource-poor island nation. In fact the primary reason the US fleet "forced Japan open" had nothing to do with Japan itself; rather, they wanted to ensure safe harbors for American whaling vessels in the west Pacific.
Thus free from most forms of colonial interference, and recently (1868) reconstituted as a nation-state under the aegis of an (ostensibly) powerful emperor, Japan had the opportunity to industrialize/modernize at breakneck speeds. Not only that, but the Japanese ruling elite cannily realized that in realpolitik terms there were only two kinds of countries in the world: predators (the Great Powers) and prey (colonized regions). So they naturally set out to join the ranks of the predators. One of the first major political crises faced by the Meiji state, in fact, was the debate over whether to immediately invade Korea, which led to a major civil war.
Please note that when I say it was "canny" of the Japanese that doesn't mean I approve, in a moral sense, of their colonial expansion. Colonialism is at its core a deeply immoral and destructive practice. What I do mean is that it was, at the time, a fully legal practice, and what's more that the ones who practiced it were, in fact, the ones who got to write the laws in the first place. If Japan wanted a seat at the table (quite literally), its best option was to become a colonial power itself.
To bring things full circle, though, the material scarcity that kept Japan from being colonized in the first place would also prove to be the downfall of its imperial fantasies. As you may know, the reason Japan attacked the US at Pearl Harbor was because the US had taken steps to choke off the very materiel that Japan desperately needed to keep its war machine running.
If you're interested in more information I'd recommend Carol Gluck's authoritative intellectual history of Meiji, Japan's Modern Myths. On colonial expansion, try Alexis Dudden's Japan's Colonization of Korea.
What time period are you talking about here? Also, to better understand where you're coming from, do you have particular reasons to believe the country was likely to end up in this position?
See: