Monday, May 24, 2010

Why does my Java application look different on different computers?

I may not have provided enough information here, but which seems the most likely?





I wrote a program, compiled using the most recent jdk (JDK 6).


I am trying to run this program on another computer with an older JRE. The formatting looks all wrong.





Which of the following is most likely the cause of my problem:





* Resolution of the two computers are different


* The JRE is too old. I more recent JRE would solve the problem


* The JDK is too new. An older JDK would solve the problem.


* Something else?

Why does my Java application look different on different computers?
As long as you are running on the same platform (both computers are windows or both are mac, etc) the jre should behave the same. The intent is to be backward compatible. The most likely cause of those listed is the resolution. But your application could also be using different fonts on the different computers.


The best place to start is to set the resolution on the dev machine to be the same as the machine with the older jre.


But it would be really easy to change all the variables (one at a time of course) to see what affects it the most. Getting an old jdk to build with, or a new jre to run with isn't too hard.


But I would check the fonts as well. Good Luck.
Reply:I have never faced such problem. But I'm interested to know the appropriate solution.





Would u kindly post this question at the Sun Developers Network Swing Forum. More experienced men should be able to answer the question correctly.





Please follow the link below.





http://forum.java.sun.com/forum.jspa?for...





Kindly provide there all the informations that u feel necessary to shoot the problem and register yourself there with the same screen name so that I can find out the question.





Thanks in advance.
Reply:java is funny...hundreds of billions of dollars of lawsuits have been fought over it..





microsoft internet explorer 6 has it's own java engine...


microsoft internet explorer 7 has an entirely different engine...


microsfoft outlook now uses the crappy msword html engine (yeah, its true...)


mozilla firefox and other open source engines are often loosely based on the old netscape engine...


there's the third party j2ee engine...you can use that..i do..


safari uses it's own engine altogehter..





yeah...different browsers use different engines...the results are gonna vary..
Reply:Hi, the problem is probably cuz Java uses the visual theming of your operating system. So if you run your code on vista, everything (eg. buttons) is styled according to vista theme; if you run your code on XP, everything is styled according to the current XP theme and so on. So on different OS the output will be different.





Try using swing and specify the style that you want to use in your application...





Hope this Helps...


No comments:

Post a Comment