[CentOS] Official Java

Mon Aug 7 18:55:07 UTC 2006
Jose Perales @ Grid System <jose.perales at gridsystems.com.ve>

Check it topi in the centos forum I was with a problem with fedora-ds and it
was perfect.

Regards

Jose
Grid Systems

http://www.centos.org/modules/newbb/viewtopic.php?topic_id=2903

Reconfiguring CentOS 4's default Java configuration. This is done as root or
equivalent and is for jre adjust for jdk where needed;

First remove /var/lib/alternatives/java file by typing;

rm /var/lib/alternatives/java

When asked press the 'y' key,

Now to create the new (corrected) alternatives file for java type the
following commands as root (modify for jdk as needed);

/usr/sbin/alternatives --install /usr/bin/java java
/usr/lib/jvm/jre-1.4.2-gcj/bin/java 1

/usr/sbin/alternatives --install /usr/bin/java java
/usr/java/j2re1.5.0_06/bin/java 2

/usr/sbin/alternatives --config java

You should now see for example:

There are 2 programs which provide 'java'.

Selection Command
-----------------------------------------------
1 /usr/lib/jvm/jre-1.4.2-gcj/bin/java
*+ 2 /usr/java/j2re1.5.0_06/bin/java

Enter to keep the current selection[+], or type selection number:

Type: <choose 1 or 2>

In the example above java is already configured correctly [*+ 2] to
use Sun's Java, no changes are needed, just press the Enter key here.
If you have been following the instructions then you should have
the same results (version numbers may be sightly different).

Now type; /usr/sbin/alternatives --display java

You should see for example;

java - status is manual.
link currently points to /usr/java/j2re1.5.0_06/bin/java
/usr/lib/jvm/jre-1.4.2-gcj/bin/java - priority 1
/usr/java/j2re1.5.0_06/bin/java - priority 2
Current `best' version is /usr/java/j2re1.5.0_06/bin/java.

Next you might want to create (or edit) /etc/profile.d/java.sh
file, example below;

export JAVA_HOME="/usr/java/jre1.5.0_06/bin"
export JAVA_PATH="$JAVA_HOME"
export PATH="$PATH:$JAVA_HOME"

When done creating or editing the file type;

source /etc/profile.d/java.sh

Now any user root or other wise should be able to use the command;

which java

and the results should read something like;

/usr/java/jre1.5.0_06/bin/java

Also any user root or other wize should be able to use the command;

java -version

and the results should read something like;

java version "1.5.0_06"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode, sharing)


That's it, all done.

-----Mensaje original-----
De: centos-bounces at centos.org [mailto:centos-bounces at centos.org] En nombre
de Ted Miller
Enviado el: Domingo, 06 de Agosto de 2006 08:14 a.m.
Para: CentOS mailing list
Asunto: [CentOS] Official Java

What is the official method to install Java on Centos?  I searched, but
could find no mention of Java on the Web site.

Ted Miller
Centos 4.3 x86_64
Indiana

_______________________________________________
CentOS mailing list
CentOS at centos.org
http://lists.centos.org/mailman/listinfo/centos