Find the answer to your Linux question:
Results 1 to 2 of 2
Hello: I have a new CentOS 6.3 installation. I'm a little confused about environment variables. I installed the Java 7 SDK in /usr/java/jdk7 I placed a file called java.sh in ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Dec 2012
    Posts
    5

    Help with "which" and environment variables please


    Hello:

    I have a new CentOS 6.3 installation. I'm a little confused about environment variables.

    I installed the Java 7 SDK in /usr/java/jdk7

    I placed a file called java.sh in /etc/profile.d... the contents of which are:

    export JAVA_HOME=/usr/java/jdk7
    export PATH=$JAVA_HOME/bin:$PATH

    When I typed java -version from the command line, I got this:

    OpenJDK Runtime Environment (IcedTea6 1.11.5) (rhel-1.50.1.11.5.el6_3-x86_64)
    OpenJDK 64-Bit Server VM (build 20.0-b12, mixed mode)

    Which is WRONG. So I did which java and got this:

    /usr/bin/java

    But if I do set | grep PATH

    PATH=/usr/lib64/qt-3.3/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/dogzilla/bin:/usr/java/jdk7/bin

    I see the /usr/bin is in the path and I'm guessing that's how the OpenJDK gets seen instead of my install of the JDK.

    The problem is, I obviously want "which java" to reflect my install and not the one in /usr/bin/java

    Any assitance you can provide is greatly appreciated. Thanks!

  2. #2
    Just Joined!
    Join Date
    Nov 2008
    Posts
    2
    Hello,

    I am not an linux expert but you can check your system environment as use command env as there are few Java related veriables

    JRE_HOME=/usr/java/default/jre
    JAVA_BINDIR=/usr/java/default/bin
    JAVA_HOME=/usr/java/default
    SDK_HOME=/usr/java/default
    JDK_HOME=/usr/java/default
    JAVA_ROOT=/usr/java/default

    try to change them to java you want to use.
    I think it removing OpenJDK is a valid scenario.

    I hope this helps.

    Best Regards,
    xa3apm

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •