Find the answer to your Linux question:
Results 1 to 3 of 3
I am using CentOS flavor well by using "yum list installed" command java open jdk 1.6 is installed... when i type ...java command it shows some output related to java ...
  1. #1
    Just Joined!
    Join Date
    May 2010
    Posts
    5

    Question Java Installation Problem in CentOs Which JAVA

    I am using CentOS flavor

    well by using "yum list installed" command
    java open jdk 1.6 is installed...

    when i type ...java command
    it shows some output related to java command
    it means that java is installed

    I downloaded java 1.7 version package(.tar.gz)
    and
    installed in /usr/bin/java/jdk1.7.0.
    and
    set the classpath and path files java_home in bashprofile and bashrc

    when i run java command i shows the output it simply means java is installed and javac also worked

    I succesfully installed the java 1.7 overriding the openjdk1.6
    verified by java -version command...


    But

    when I type comand "which java" command it show the output as /usr/lib/java where the java openjdk 1.6 is installed primiraliy comes with the os

    if the older version is overridden the
    it should show the output as /usr/bin/java/jdk1.7.10

    it means that java 1.6 is not overridden ???
    ???
    ??

  2. #2
    Trusted Penguin Roxoff's Avatar
    Join Date
    Aug 2005
    Location
    Nottingham, England
    Posts
    3,393
    It can get really messy. Use the 'alternatives' tool to straighten out the Java system, you need to run this from the command line. Check out its man page.
    Linux user #126863 - see http://linuxcounter.net/

  3. #3
    Linux Guru
    Join Date
    May 2011
    Posts
    1,843
    Roxoff is right. I've done this so many times I wrote it down. I do something like this:

    Code:
    # back up the original java
    [ -f /usr/bin/java ] && mv /usr/bin/java /usr/bin/java160
    
    # use alternatives command to install links and stuff
    update-alternatives --install "/usr/bin/java" "java" "/usr/bin/java/jdk1.7.0/bin/java" 1
    In the second command, replace with "/usr/bin/java/jdk1.7.0/bin/java" with whatever is the proper path to the java binary.

Posting Permissions

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