I dont know but it seems there are several solutoins for Java (Java SE, ME ...) for different platforms so you have to write different versions of the same application for all devices (iOS, Android, Windows, Linux ...).
(Is it even possible to use Java ME on devices running Android and iOS?)
Is there a solution for Java to create just one application which runs seamless on all devices? Or do we have to rewrite the application for different devices?
I guess, the future of cross portable apps is HTM5, CSS3 and Javascript. Java (or DART) can be used as high level language to generate the Javascript.
I suggest you to have a look at phonegap and mobilegwt for the mobile, and for the desktop Adobe Air.
You can write a mobile/desktop application in Java using mobilegwt. Then you cross compile the application for the different browsers (iphone, ipad, android, blackberry, desktop), and package the javascript+html+css+images inside a native app for all the platforms.
Your application can run from a web server (downloading html, and everything) or be a javascript application running completely from the device; or being a mixture of the two things: a javascript application deployed into the native app and running from the device, doing AJAX calls to a server.
Those application are frequently called hybrid applications.
Eventually you can skip the java part and develop an html5+css3 app and package with phonegap for the different platforms. But I find mobilegwt being able to produce hybrid apps who look like native apps (with "look and feel" and animation very well implemented). And GWT helps in bringing the scalability of the Java language (reusable components, tools, and OO) to Javascript.
For the desktop you can package an html5 app with Adobe Air.
For videogames, I think playn deserve some attention, being able to cross compile games for Desktop Java, HTML5 Browsers, Android, iOS, Flash (and more), and producing impressive results like Angry Birds for Chrome (cross compiled from Java to Javascript).