www.centos.org Forum Index CentOS 4 - Application & Software Support Adding Java 1.5.0_06 to alternatives system?
|
Bottom Previous Topic Next Topic |
| |
|
|
|---|
| Poster | Thread | Rated: 1 Votes |
|---|
|
Re: Adding Java 1.5.0_06 to alternatives system? | #2 |
|
|---|---|---|---|
|
Professional Board Member
![]()
Joined: 2005/11/29
From Indiana
Posts: 2283
|
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. |
||
|
_________________
CentOS: The Sysadmins choice Congratulations NedSlider |
|||
Posted on: 2006/1/28 10:21
|
|||
|
Re: Adding Java 1.5.0_06 to alternatives system? | #3 |
|
|---|---|---|---|
|
Regular Board Member
![]()
Joined: 2004/12/25
From Greensboro, NC
Posts: 74
|
Thanks for the detailed instructions. I'll give it a try when I get to work on Monday.
Bob |
||
Posted on: 2006/1/30 0:41
|
|||
|
Re: Adding Java 1.5.0_06 to alternatives system? | #4 |
|
|---|---|---|---|
|
Newbie
![]()
Joined: 2006/1/31
From
Posts: 4
|
Many thanks Lenard for the detailed instructions. I have just installed the latest jre as per your detailed instructions on a new Centos 4.2 install with not a problem. All is working fine for me so far.
Thanks again. |
||
Posted on: 2006/1/31 12:35
|
|||
|
Re: Adding Java 1.5.0_06 to alternatives system? | #5 |
|
|---|---|---|---|
|
Newbie
![]()
Joined: 2006/3/1
From
Posts: 3
|
I did accordingly and it seems alright till the last step 'java -version' it says 'command not found'
I have also installed openoffice2.0.1 and it works fine and also another application (cmap) that also has jre directories on their own. But I could not make the JRE working universal in centos4.2 so that I could run radrails (radrails.org). Thanks! |
||
Posted on: 2006/3/1 8:55
|
|||
|
Re: Adding Java 1.5.0_06 to alternatives system? | #6 |
|
|---|---|---|---|
|
Professional Board Member
![]()
Joined: 2005/11/29
From Indiana
Posts: 2283
|
Show the output from the commands;
$PATH /usr/sbin/alternatives --display java cat /etc/profile.d/java.sh |
||
|
_________________
CentOS: The Sysadmins choice Congratulations NedSlider |
|||
Posted on: 2006/3/1 10:59
|
|||
|
Re: Adding Java 1.5.0_06 to alternatives system? | #7 |
|
|---|---|---|---|
|
Newbie
![]()
Joined: 2006/3/1
From
Posts: 3
|
1. $ $PATH
bash: /usr/kerberos/bin:/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/usr/java/jre1.5.0_06/bin:/home/drbista/bin:/usr/java/jre1.5.0_06/bin: No such file or directory 2. $ /usr/sbin/alternatives --display java 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. 3. $ cat /etc/profile.d/java.sh export JAVA_HOME="/usr/java/jre1.5.0_06/bin" export JAVA_PATH="$JAVA_HOME" export PATH="$PATH:$JAVA_HOME" |
||
Posted on: 2006/3/2 9:11
|
|||
|
Re: Adding Java 1.5.0_06 to alternatives system? | #8 |
|
|---|---|---|---|
|
Professional Board Member
![]()
Joined: 2005/11/29
From Indiana
Posts: 2283
|
Everything looks normal, try specifing the full path;
/usr/java/j2re1.5.0_06/bin/java -version |
||
|
_________________
CentOS: The Sysadmins choice Congratulations NedSlider |
|||
Posted on: 2006/3/2 12:29
|
|||
|
Re: Adding Java 1.5.0_06 to alternatives system? | #9 |
|
|---|---|---|---|
|
Newbie
![]()
Joined: 2006/3/1
From
Posts: 3
|
The output is still the same:
![]() $ /usr/java/j2re1.5.0_06/bin/java -version bash: /usr/java/j2re1.5.0_06/bin/java: No such file or directory |
||
Posted on: 2006/3/2 17:52
|
|||
|
Re: Adding Java 1.5.0_06 to alternatives system? | #10 |
|
|---|---|---|---|
|
Professional Board Member
![]()
Joined: 2005/11/29
From Indiana
Posts: 2283
|
OK, check the directory you should have some files in /usr/java/jre1.5.0_06/bin/ directory, for example;
$ ls -al /usr/java/jre1.5.0_06/bin/ total 1332 drwxr-xr-x 2 root root 4096 Jan 24 12:43 . drwxr-xr-x 7 root root 4096 Jan 24 12:43 .. -rwxr-xr-x 1 root root 4153 Nov 10 16:47 ControlPanel -rwxr-xr-x 1 root root 63984 Nov 10 17:18 java -rwxr-xr-x 1 root root 17567 Nov 10 17:18 java_vm -rwxr-xr-x 1 root root 163997 Nov 10 17:18 javaws -rwxr-xr-x 1 root root 71848 Nov 10 17:18 keytool -rwxr-xr-x 1 root root 71848 Nov 10 17:18 kinit -rwxr-xr-x 1 root root 71848 Nov 10 17:18 klist -rwxr-xr-x 1 root root 71848 Nov 10 17:18 ktab -rwxr-xr-x 1 root root 71848 Nov 10 17:18 orbd -rwxr-xr-x 1 root root 71848 Nov 10 17:18 pack200 -rwxr-xr-x 1 root root 71856 Nov 10 17:18 policytool -rwxr-xr-x 1 root root 71848 Nov 10 17:18 rmid -rwxr-xr-x 1 root root 71848 Nov 10 17:18 rmiregistry -rwxr-xr-x 1 root root 71848 Nov 10 17:18 servertool -rwxr-xr-x 1 root root 71848 Nov 10 17:18 tnameserv -rwxr-xr-x 1 root root 221893 Nov 10 17:18 unpack200 And you shold have a hidden .java directory for each user. |
||
|
_________________
CentOS: The Sysadmins choice Congratulations NedSlider |
|||
Posted on: 2006/3/2 18:39
|
|||
|
Re: Adding Java 1.5.0_06 to alternatives system? | #11 |
|
|---|---|---|---|
|
Newbie
![]()
Joined: 2006/4/6
From Oklahoma
Posts: 1
|
Lenard - Thanks for the great instructions! They worked perfectly.
![]() |
||
Posted on: 2006/4/6 13:54
|
|||
|
Re: Adding Java 1.5.0_06 to alternatives system? | #12 |
|
|---|---|---|---|
|
Newbie
![]()
Joined: 2006/6/3
From Pennsylvania
Posts: 1
|
Would I do the same thing for javac?
|
||
Posted on: 2006/6/6 22:11
|
|||
Top Previous Topic Next Topic |
|



Topic options
Print Topic
Threaded
Newest First
1 Votes
rje_nc







You cannot start a new topic.
You can view topic.