The results and ramblings of research

phewww!

SUN Java, update-alternatives on CentOS

with 7 comments

There seem to be too many version of java on my machine right now. To add to my misery there is openjdk, gcj, sun java 1.4, 1.5, 1.6 all install. However unix allows for quick configuration of jvms using update-alternatives.
To install/ register a JVM use the following

/usr/sbin/alternatives --install "/usr/bin/java" "java" "/usr/java/default/bin/java" 2
/usr/sbin/alternatives --install "/usr/bin/javac" "javac" "/usr/java/default/bin/javac" 2

And to configure systemwide changes use

/usr/sbin/alternatives --configure java
/usr/sbin/alternatives --configure javac
Advertisements

Written by anujjaiswal

June 14, 2011 at 9:27 pm

Posted in JAVA

Tagged with , ,

7 Responses

Subscribe to comments with RSS.

  1. nice, this is just what i needed. Thanks!

    john

    November 17, 2011 at 1:13 am

  2. […] See this blog […]

  3. how do i remove one of the alternatives?

    dodo

    December 18, 2012 at 11:04 am

    • Hey

      The general command is
      alternatives [options] –remove name path

      sudo /usr/sbin/alternatives –config java

      And get output

      Selection Command
      ———————————————–
      1 /usr/lib/jvm/jre-1.5.0-gcj/bin/java
      + 2 /usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin/java
      * 3 /usr/lib/jvm/jre-1.6.0u5-sun/bin/java

      To remove the first option you would run

      sudo alternatives –remove java /usr/lib/jvm/jre-1.5.0-gcj/bin/java

      anujjaiswal

      December 18, 2012 at 2:05 pm


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s

%d bloggers like this: