Can I install multiple Java environments on my Linux box?

Nathan Meyers

Yes... the trick is not to get confused about which one you are using. There are basically three environment variables that are important in choosing your Java environment:

  • 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.

Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact