[CentOS] Official Java

Mon Aug 7 21:24:45 UTC 2006
Jim Perrin <jperrin at gmail.com>

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

You don't need to do this.

> rm /var/lib/alternatives/java

Why, you just add the same entry below, and not in the complete context?


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

Again, you can have multiples, and in fact this is what the jpackage
compatibility rpm does for you.

> /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

These all leave out loads of options that you should have. While it
does provide a functioning java setup, it does not provide a complete
one, and also removes functionality provided by the original gcj
setup.



> 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"


If you're using the alternatives framework you listed above, there's
no need to add java to the path. This is redundant. Also, if
alternatives is used properly, the other things will be taken care of
automagically.



> which java

This works before you even install java, as it's a null file provided
by gcj. It's simply not competely functional

> and the results should read something like;
> /usr/java/jre1.5.0_06/bin/java

This is because you've made your java path redundant in previous
statements. If you're using alternatives correctly, and not screwing
with the path after the fact, it should still return the original
file, which is: /usr/bin/java

>
> That's it, all done.
It might work, but it's a very broken implementation.

Not meant to be harsh, simply meant to correct bad information.


Also, please don't top post. It's bad for the flow of such messages.


-- 
During times of universal deceit, telling the truth becomes a revolutionary act.
George Orwell