Java took off rapidly. It met an immediate need on the fast-growing World Wide Web
I've been doing web stuff pretty much since Java was around. It was only ever niche on the web. Back then computers didn't have the oomph to do much fancy graphics in a virtual machine so Java was essentially limited to cryptography.
The cross-platform stuff was then, and still largely is, marketing. Sun was a single platform hardware company. But it managed to successfully market Java as a better (because memory managed and thus safer) C++. Netscape PR aside, the real work was in getting Java onto CS degree courses meaning that graduates were trained in something that was being pushed at managers. Moore's law meant that memory was much less of a restriction than it had been: for enough money Sun or IBM could sell you hardware beyond your wildest dreams. This is why Sun did so well out of the dot-coms.
It never really went anywhere on the desktop. I can only think of a handful of applications written in Java that I've ever used. The Java ME stuff was also pretty limited, largely due to the hardware (phones didn't have much memory and write once, run everywhere never really worked).
Flash, developed by Macromedia succeeded by being a better development environment for non-programmers than Java. ActionScript may have been a shitty runtime but it did what it needed to well, or well enough to create sufficient demand for ubiquity. This is why many new languages target non-CS graduates so much: traction is perhaps more important than having the best runtime.
Java's legacy may well be the work that went into JIT compiling which has now become pretty universal. Develop in whatever language you like and the right JIT will compile it to near native speed.