I am on a RHEL 5.5 64 bit box.  The systems engineer installed the 64-bit Java VM under /usr/bin ; however, I needed a 32 bit VM which he installed in /opt/jdk1.6.0_35. But now, everytime I do java -version it shows that I'm using the 64-bit VM. How do I force it to select the 32 bit VM? I changed the PATH to not include /usr/bin, but that's where most of the important programs like vi and nano are, and I cannot exclude that. Is there another variable I can add to force it to select the 32 bit VM by default?
How to force a particular version of Java?
linux;rhel;path;java
You just need to put the location of the new binary in your PATH first. When you try to run java, the shell will search your path for the first instance and run it. Try this:$ export PATH=/opt/jdk1.6.0_35/bin:$PATHThat's assuming you're using bash, or a similar shell. Now any commands that exist in /usr/bin/ will be overridden by those in the new directory.