I've been coding in Java for over a dozen years now and I can say without equivocation you're either a liar who's never actually worked with it or you're a fucking troll. Write once, run anywhere is is 100% real and is so common that it's a joke.
I agree, with some minor caveats. Using public APIs, avoiding deprecated sections, is generally very safe. Using anything in the sun.* packages as well as undocumented behavior is no-man's land. I worked on a project that actively exploited bugs in Swing in Java 5, and broke on Java 6. Recoding the sections that took advantage of "undocumented features" restored it to correct functionality regardless of the JRE version. Again, using documented, supported parts of the JFC is key. Not actively trying to do things that ought not to be done is important.
For example, building filesystem paths where the path separator is hard-coded.
The I/O library in Java automatically corrects this. You can even mix "/" and "\" in the same path and it will work.