CentOS Icon CentOS Logo
CentOS Text
   
  
www.centos.org Forum Index
   CentOS 5 - Application & Software Support
  Help with java installation

 

 Bottom   Previous Topic   Next Topic
  •  Rate Thread
      Rate this Thread
      Excellent
      Good
      Average
      Bad
      Terrible
Poster Thread Rated:  3 Votes
  •  mearturo
      mearturo
Help with java installation
#1
Peeking in the Member Window
Joined: 2007/4/22
From
Posts: 22
Hello,

I just installed Centos5, and now I need to install java.
It seems that Centos5 creates many directories for java and many sym links, for instance there are java directories in /etc/, /etc/alternatives/, /usr/share/, /usr/lib/

Do I need those directories?
How do I install Java 1.6 ?

Thanks a lot
Posted on: 2007/5/11 11:37
Create PDF from Post Print
Top
  •  Lenard
      Lenard
Re: Help with java installation
#2
Professional Board Member
Joined: 2005/11/29
From Indiana
Posts: 2283
Review:

http://java.sun.com/javase/6/webnotes/install/jdk/install-linux.html#install-rpm

http://plugindoc.mozdev.org/faqs/java.html

And this may prove helpful;

Reconfiguring the default Java configuration for Red Hat / Fedora

This is done as root or equivalent.

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;

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

For jre:

/usr/sbin/alternatives --install /usr/bin/java java /usr/java/jre1.6.0/bin/java 2

For jdk:

/usr/sbin/alternatives --install /usr/bin/java java /usr/java/jdk1.6.0/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/jre1.6.0/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/jre1.6.0/bin/java
/usr/lib/jvm/jre-1.4.2-gcj/bin/java - priority 1
/usr/java/jre1.6.0/bin/java - priority 2
Current `best' version is /usr/java/jre1.6.0/bin/java.

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

For jre;

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

For jdk;

export JAVA_HOME="/usr/java/jdk1.6.0/jre/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/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.6.0"
Java(TM) SE Runtime Environment (build 1.6.0-b105)
Java HotSpot(TM) Client VM (build 1.6.0-b105, mixed mode, sharing)
_________________
CentOS: The Sysadmins choice
Congratulations NedSlider
Posted on: 2007/5/11 11:48
Create PDF from Post Print
Top
  •  mearturo
      mearturo
Re: Help with java installation
#3
Peeking in the Member Window
Joined: 2007/4/22
From
Posts: 22
Hello,

Thanks a lot for your help, now everything works fine.

One more (silly) question, what is the purpose of those 'alternatives'?

Thanks again for your fast help

Arturo
Posted on: 2007/5/12 13:58
Create PDF from Post Print
Top
  •  Lenard
      Lenard
Re: Help with java installation
#4
Professional Board Member
Joined: 2005/11/29
From Indiana
Posts: 2283
First, your welcome, glad to help.

In answer to guestion, so Sun's java gets configured properly for use with CentOS. you can find more about the alternatives by typing from the virtual console or xterm session: man alternatives
_________________
CentOS: The Sysadmins choice
Congratulations NedSlider
Posted on: 2007/5/12 16:47
Create PDF from Post Print
Top
  •  xephonics
      xephonics
Re: Help with java installation
#5
Newbie
Joined: 2005/8/28
From
Posts: 5
I followed your instructions perfectly (well i think it is perfectly, i double checked all your instructions and checks and it looks the same), but all my java apps still appear blank in mozilla.

It does not give the install missing plug error or anything, they just show as blank spaces.

any ideas/clues?
Posted on: 2007/6/3 1:16
Create PDF from Post Print
Top
  •  xephonics
      xephonics
Re: Help with java installation
#6
Newbie
Joined: 2005/8/28
From
Posts: 5
well that kinda sucks, i cannot find the edit button, so ill say it here-

it is now working after a full system reboot lol
Posted on: 2007/6/3 5:22
Create PDF from Post Print
Top
  •  satyajit
      satyajit
Re: Help with java installation
#7
Newbie
Joined: 2007/5/31
From
Posts: 5
Have you checked the following url?
I found it very helpful. Gives you step by step instruction as to install JDK on centOS.
How to install Java on CentOS 4 and CentOS 5
Posted on: 2007/6/4 5:02
Create PDF from Post Print
Top
 Top   Previous Topic   Next Topic

 


 You cannot start a new topic.
 You can view topic.
 You cannot reply to posts.
 You cannot edit your posts.
 You cannot delete your posts.
 You cannot add new polls.
 You cannot vote in polls.
 You cannot attach files to posts.
 You cannot post without approval.




"Linux" is a registered trademark of Linus Torvalds. | All other trademarks are property of their respective owners. | All other content is Copyright @ 2004-2009 by the CentOS Project or "each individual contributor (forums, comments, etc.) unless otherwise assigned".| Theme based on a theme by 7dana.com