1 Reply Latest reply: Apr 17, 2013 2:06 AM by kumar_1302 RSS

    Setting java path in Linux

    kumar_1302
      Hi,

      I have installed Java 7 using rpm file: jdk-7u17-linux-x64.rpm, with the help of below command on my linux box:

      rpm -ivh jdk-7u17-linux-x64.rpm

      After completing the installation the java is installed in location "/usr/java/jdk1.7.0_17", when I try to find the jave version I am getting different result:

      -------------
      java version "1.6.0_22"
      OpenJDK Runtime Environment (IcedTea6 1.10.4) (rhel-1.41.1.10.4.el6-x86_64)
      OpenJDK 64-Bit Server VM (build 20.0-b11, mixed mode)
      ----------------

      It is still pointing to 1.6 which was installed on my linux box earlier. How can I make sure that the java command uses the latest installed JDK 7?
        • 1. Re: Setting java path in Linux
          Nik
          Hi.

          which java show what file select for this command.

          Environment variable PATH set order of path for find executable file.


          Try set:

          export PATH=/usr/java/jdk1.7.0_17/bin:$PATH
          export JAVA_HOME=/usr/java/jdk1.7.0_17


          add this commands to $HOME/.profile for make this changes permanent.


          Regards.