Can I install multiple Java environments on my Linux box?
- PATH controls where executables will be found - make sure the executables you want will be found first.
- CLASSPATH controls where classes will be found. Different environments have different requirements for the CLASSPATH - you often do not need to set it at all. But if you do set it, be sure not to include components from Java environments other than the one you're running.
- JAVA_HOME is not used by JDK1.2 and later environments, but some earlier Java environments did use it, and some scripts depend on it. If this variable is set, make sure that it does not point to a different Java installation than the one you're trying to use.
A common, and very confusing, situation is to have a Sun JDK and Kaffe installation on the same box - many Linux distributions now routinely install Kaffe, placing the executables in /usr/bin. Since Kaffe includes executables named java, javac, appletrunner, and such, you will end up running those executables instead of Sun JDK executables unless you put the JDK bin/ directory earlier in the path. As Kaffe does not support a significant subset of the JDK1.2 spec, many 1.2 applications and applets will fail to run or find needed classes. Results can also get extremely strange if you mix the Kaffe JVM with Sun's JDK classes, or vice versa.