The unfortunate and unnecessary state of affairs with incompatible Java implementations, opening the door for Microsoft to promote its DefectiveX "alternative".

Of course, Microsoft helped _create_ this situation, in a fine example of FUD.

The threat of Microsoft's custom "embrace and extend" changes to Java, referred to in another writeup, has passed. However, there are still reasons to test Java programs on multiple platforms. Despite the "Write Once, Run EverywhereTM" Java slogan that this phrase mocks, Java programs can run differently on different OSes. Some places where problems can arise:

  • Use of native code extensions. Many large or complex systems need to call out to the native OS for some specialized functionality. This means that the programs have OS dependent libraries and behaviours which must be tested.
  • Use of AWT interface elements exposes a program's UI to platform dependent interface widget bugs.
  • The underlying Java Virtual Machine is itself a native program. Despite a detailed specification, and attempts by VM vendors (Sun, IBM, HP and others) to keep the VM entirely uniform, platform dependent VM issues (bugs) are far from unknown.
  • Different code optimization approaches taken in different JVMs can also lead to behavioural issues. There are now different client and server compilers which perform different optimizations. Newer versions of Java have changed and enhanced core functionality such as the garbage collection model.

The last point is especially important. A "perfect" Java program may not be affected by Java compiler changes, but many programs, and most programmers, are not perfect. Programs which leak memory (with lingering object references) or misuse threads may manifest errors on one platform but not another because of subtle VM differences.

In fairness, it should be noted that the arrival of the Swing libraries has solved most of the AWT issues, and that the JVM implementations are very solid, as long as you stay with core functionality. (Use of non-core extensions such as JVMPI is much riskier.) In general, Java development on J2SE is reliable and robust. In the J2ME and J2EE spaces, however, rapid platform evolution means that "Write Once, Debug Everywhere" will continue to be the mantra for developers for the foreseeable future.

Jetifi adds: Testing on multiple platforms is especially advisable if you have programmers who've never used a UNIX system, and hardcode stuff like directory separators ''\'' and ''c:\'' etc.

Log in or register to write something here or to contact authors.