I have Installed JDK 7 on CentOS 32 bit virtual machine. I also have set the path for java. In one terminal it is showing java1.7 But when I open another terminal and look for, java -version It is showing java1.4

  • 1
    Where have you set the path? In e.g ~/.bashrc ?
    – MrSmith42
    Commented Oct 8, 2013 at 7:36
  • Run which java and echo $PATH on both shells, and attach the output
    – daisy
    Commented Oct 8, 2013 at 8:30
  • CentOS does not user 'alternative' command for this? '/usr/sbin/alternatives –install /usr/bin/java java /usr/java/latest/bin/java 20000'
    – BitsOfNix
    Commented Oct 8, 2013 at 11:36
  • How did you install Java? Via the RPMs or as a tarball? if-not-true-then-false.com/2010/…
    – slm
    Commented Dec 6, 2013 at 7:16

1 Answer 1


That's just because you probably set the path for java using export in a terminal. That will only work for the current session (terminal).

To make it permanent, you would have to add the export line you used to your ~/.bashrc file.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .