Find the answer to your Linux question:
Results 1 to 6 of 6
Hi, We are struggling with java version on our Linux Server "which java" returns /usr/bin/java "java -version" returns java version "1.5.0_20" Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_20-b02) Java ...
  1. #1
    Just Joined!
    Join Date
    Oct 2009
    Posts
    6

    Java Version

    Hi,

    We are struggling with java version on our Linux Server

    "which java" returns
    /usr/bin/java

    "java -version" returns

    java version "1.5.0_20"
    Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_20-b02)
    Java HotSpot(TM) Server VM (build 1.5.0_20-b02, mixed mode)


    Tried to upgrade java using yum. Yum shows that latest version 1.6.0 is already installed

    "alternatives --config java" returns
    There is 1 program that provides 'java'.

    Selection Command
    -----------------------------------------------
    *+ 1 /usr/lib/jvm/jre-1.6.0-openjdk/bin/java

    which is java 1.6.0

    We want java to point to version 1.6.0 and not to 1.5.0

    Please suggest.

    Thanks for your help

  2. #2
    Linux User
    Join Date
    Nov 2009
    Location
    France
    Posts
    292
    Code:
    export PATH="/usr/lib/jvm/jre-1.6.0-openjdk/bin:$PATH"
    export JAVA_HOME="/usr/lib/jvm/jre-1.6.0-openjdk"
    in ~/.bashrc

    or in /etc/profile (if it exists in Fedora/Red Hat) and reboot.
    0 + 1 = 1 != 2 <> 3 != 4 ...
    Until the camel can pass though the eye of the needle.

  3. #3
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,974
    You can have many versions of java installed on your system. If you look in /usr/java, you will see a number of directories for the java versions you have installed such as jdk1.6.0_20, jrel.5.0_10, etc. You will also see two links. One is 'default' and the other is 'latest'. If you look at /usr/bin/java, typically it is a link to /usr/java/default/bin/java. /usr/java/latest is usually a link to the most recent java installation you made, and while /usr/java/default may point to 'latest', it may not. You should be able to change the default java implementation simply by changing the link from 'default' to the version you need.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  4. #4
    Just Joined!
    Join Date
    Oct 2009
    Posts
    6

    Thanks

    Thanks Everyone.

    Setting Path in /etc/profile helped

    regards

  5. #5
    Just Joined!
    Join Date
    Oct 2009
    Posts
    6
    Quote Originally Posted by nmset View Post
    Code:
    export PATH="/usr/lib/jvm/jre-1.6.0-openjdk/bin:$PATH"
    export JAVA_HOME="/usr/lib/jvm/jre-1.6.0-openjdk"
    in ~/.bashrc

    or in /etc/profile (if it exists in Fedora/Red Hat) and reboot.
    Hi,

    As suggested I made the changes to /etc/profile to set the default Java version
    After I did so, the java -version shows me
    1.6.0 but when I run Catalina.sh it shows java version as 1.5.0

    env also shows that Java points to 1.5.0

    I changed the variable JAVA_HOME and JRE_HOME by exporting the right values. It works fine till the time I reboot the machine. After I reboot, the variable again points to 1.5.0 even though /etc/profile points to 1.6.0

    Is there any other file that sets the variables at boot time.

    Thanks

  6. #6
    Linux User
    Join Date
    Nov 2009
    Location
    France
    Posts
    292
    You may start catalina through a script, something like
    Code:
    #!/bin/bash
    export JAVA_HOME="/<path_to>/<java_1.6>"
    su nobody -c "/<path_to>/apache-tomcat-6.0.16/bin/startup.sh"
    That's what I had to do at least, long ago...
    0 + 1 = 1 != 2 <> 3 != 4 ...
    Until the camel can pass though the eye of the needle.

Posting Permissions

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