Fog Creek Software
Discussion Board

Java VM Compatibility

I attended a seminar today where the speaker (an Oracle consultant) was talking about Java portability and claimed that Java VMs from different vendors that support the same version of Java are always compatible. He said there would be no problems running code written for one platform on a same-version VM on another platform.

I'm sure I've read words to the contrary from people using Java in the real world. Has anyone here any experiences they can share on this issue?

John Topley
Friday, January 10, 2003

Incompatibility is especially apparant when you are going after backward compatibility. Old browsers of one brand or other all handle Java applets in slightly different ways. There are even one of two browser VMs that can't even multi-task using threads. But you can always use a safe subset of the full range of APIs, compatibility will get you very far on the server-side provided you note some of the big gotchas. The foundation libraries works pretty well, but you probably have to have a support line and test on all VMs your customers might use.

Li-fan Chen
Friday, January 10, 2003

In my experience, there is no problem of JVM compatibilities for the same version if  :

* JDK >= version 1.2
* The threading model is the same (ie: Java thread mapped 1 to 1 to to system threads. No multithreads emulation -- green threads)

Disclaimer: My experience is based with Sun Solaris and Microsoft Windows JavaSoft JVM.

Robert Chevallier
Friday, January 10, 2003

We are currently using J2SE and J2ME from Sun for our product.  Both work as expected.  We are also evaluating 2 VM's from 3rd parties because they offer increased performance over the Sun VM. 

To date, we have identified several bugs in the 3rd party VM's (which they intend to fix), but barring that no incompatabilities. 

Stephen Jackson
Friday, January 10, 2003

The only "incompatabilities" I've found with various JVMs are GUI inconsistancies. OSX's JVM wants to use native widgets, and they sometimes come out looking strange. The fonts don't always look the same either.

All in all though, everything runs. It just might not be pretty.

Friday, January 10, 2003

Recent (jdk 1.2 and above) compatibility tends to be really good.  On the server side especially I have no expectation that, for example, code I write and test on Windows XP, will need to be debugged on Linux.  There are some mistakes one can make in this regard (classic example, hard coding the file separator character in a string instead of using the java libraries to retrieve the appropriate one for the platform the code is running on).

Erik Lickerman
Friday, January 10, 2003

I've developed some J2EE systems that were ported from one OS to another. In one project, it was Solaris -> HP-UX, in the other HP-UX -> AIX with Linux and Windows also being used in development environments.

For the most part, things worked out OK. The only problems were minor. For example, HP's java has some bugs that needed to be worked around (threading, how it did string tokenizing different, etc.) Also, some OS's don't support the same JDK versions - for example, Solaris and HP-UX were always behind Windows in terms of patches and bug fixes.

Monday, January 13, 2003

One more...

When we moved to AIX, there were some problems with the JDBC drivers.

1. setFloat() didn't work properly, had to use setDouble() instead.

2. the first time you call getString on a numeric column it comes back fine, however, the second time it would add an random number of zeros. Had to use a patch from IBM that was not public to get around this one.

Monday, January 13, 2003

The only "incompatabilities" I've found with various JVMs are GUI inconsistancies. OSX's JVM wants to use native widgets, and they sometimes come out looking strange. The fonts don't always look the same either.

I found that the only way to get round this was to just to do by the book and trust in the layout managers. All in all it came out OK.

Oh EXCEPT the Swing FileChooser doesn't work, and you have to use the AWT one. Which doesn't work on Windows. D'oh!

Owen Green
Thursday, January 16, 2003

*  Recent Topics

*  Fog Creek Home