Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
up vote 3 down vote accepted

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:$PATH

That'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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.