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
On 8/6/06, Ted Miller tmiller@broadcast.net wrote:
What is the official method to install Java on Centos? I searched, but could find no mention of Java on the Web site.
Currently the "Best" method (very relative term here) is to get the sun java rpm from java.sun.com and install it. (run the bin, agree to the license and all that)
This puts java on your system in /usr/java/java-version which is kind of a screwed up place, and is not in any user's path by default. To resolve this and make things work, you then need to install the compat-sun-java rpm from jpackage.org for your particular version of java. This puts it into the alternatives framework which fixes the path issues, sets it as the default, and makes it work. Hppefully there will be a better method soon.
Ted Miller wrote:
What is the official method to install Java on Centos? I searched, but could find no mention of Java on the Web site.
Here are some notes that I have: ==================================
http://java.sun.com/javase/downloads/index.jsp
Select the option JRE 5.0 Update <n>
Download the file:
chmod the file: chmod u+x the_file_you_downloaded
exexute the file /the_file_you_downloaded
Add the new directory in your path (this is usually something like /usr/java/jre1.x.x/bin)
Once installed make certain that it runs and that you have the correct version by typing the following at a command prompt: java -version It should display a message similar to the following: java version "1.5.0-rc" Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-rc-b63)
=======================================
Oh, and save the rpm that came out of the ./the_file_you_downloaded
You can install it on any number of systems without telling Sun ;-)
Ted Miller wrote:
What is the official method to install Java on Centos? I searched, but could find no mention of Java on the Web site.
I don't know about "official," but what I normally do is install Sun's JDK, then the compatibility package from jpackage.org. The Sun stuff out of the box does not work with the "alternatives" system in CentOS, but the jpackage package fixes that up and sets up a more "sane" environment. The name is usually something like 'java-{version}-sun-compat-{version and release}, you will find it under the "non-free" section of the jpackage.org web site. This package provides symlinks and directories to make the vendor-provided JDK play nice.
Don't be put off by the "non-free" part, it just means that the packages require "encumbered" components (like Sun's JDK) to be rebuilt or installed. Official has nothing to do with it, but I find that it is a bit "cleaner" than just the Sun-provided JDK.
Hope that helps!
On Aug 6, 2006, at 8:13, Ted Miller wrote:
What is the official method to install Java on Centos? I searched, but could find no mention of Java on the Web site.
Like others already mentioned, there is no "official" way, and like others, I like to install the Sun JRE. I then run the following "alternatives" commands to make it the default version (this assumes you are using version 1.5.0_07 of the JRE):
# alternatives --install /usr/bin/java java /usr/java/jre1.5.0_07/ bin/java 10 \ --slave /usr/bin/rmiregistry rmiregistry /usr/java/jre1.5.0_07/ bin/rmiregistry \ --slave /usr/lib/jvm/jre jre /usr/java/jre1.5.0_07 # alternatives --set java /usr/java/jre1.5.0_07/bin/java
I currently have a dozen or so developer systems deployed using CentOS 4.3 and the aforementioned Sun JRE 1.5.0_07.
Alfred
Alfred von Campe wrote:
On Aug 6, 2006, at 8:13, Ted Miller wrote:
What is the official method to install Java on Centos? I searched, but could find no mention of Java on the Web site.
Like others already mentioned, there is no "official" way, and like others, I like to install the Sun JRE. I then run the following "alternatives" commands to make it the default version (this assumes you are using version 1.5.0_07 of the JRE):
# alternatives --install /usr/bin/java java /usr/java/jre1.5.0_07/bin/java 10 \ --slave /usr/bin/rmiregistry rmiregistry /usr/java/jre1.5.0_07/bin/rmiregistry \ --slave /usr/lib/jvm/jre jre /usr/java/jre1.5.0_07 # alternatives --set java /usr/java/jre1.5.0_07/bin/java
Where can I find some information on this 'alternatives' commands to understand what you did here.
My system is quite messed up right now with jre between jpackage and Sun stuff. Freemind is working, but Java in Firebird is broken.
I currently have a dozen or so developer systems deployed using CentOS 4.3 and the aforementioned Sun JRE 1.5.0_07.
Alfred _______________________________________________ CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
Robert Moskowitz wrote:
Where can I find some information on this 'alternatives' commands to understand what you did here.
It has a manual page (but not really anything more to it) :)
Ralph
Ralph Angenendt wrote:
Robert Moskowitz wrote:
Where can I find some information on this 'alternatives' commands to understand what you did here.
It has a manual page (but not really anything more to it) :)
Hmmm. Maybe the best way to see how ugly alternatives can be is to download the java-*-sun-compat package from jpackage org and do a "rpm -qp --scripts java-*-sun-compat*rpm".
But that also shows how powerful it can be.
Ralph
Ralph Angenendt wrote:
Robert Moskowitz wrote:
Where can I find some information on this 'alternatives' commands to understand what you did here.
It has a manual page (but not really anything more to it) :)
Man pages?
You mean a person should check there before doing a web search? :-[
Robert Moskowitz wrote:
Ralph Angenendt wrote:
Robert Moskowitz wrote:
Where can I find some information on this 'alternatives' commands to understand what you did here.
It has a manual page (but not really anything more to it) :)
Man pages?
You mean a person should check there before doing a web search? :-[
[angenenr@shutdown ~]$host man.google.com Host man.google.com not found: 3(NXDOMAIN)
So, yes, why not? =:)
Ralph
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@centos.org [mailto:centos-bounces@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@centos.org http://lists.centos.org/mailman/listinfo/centos
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.