[CentOS] Java installation problem.

Sun Aug 7 03:35:51 UTC 2005
Matt Arnilo S. Baluyos (Mailing Lists) <matt.baluyos.lists at gmail.com>

On 8/7/05, duffmckagan <mckagan at gmail.com> wrote:
> Thanks for the reply. ....that was cool.
> That thing made the things quite clear.
> I will download the package from Dag's repository tomorrow, and
> uninstall the one from Sun.
> 
> I need to sleep this night.
> See you guys tomorrow. (I am in a different time zone.)

Hello,

Below are the steps I'm using to install the Java 5 SDK that is from
Sun. I hope this helps you. This has worked for me every time.

Anyway, below are the steps I did to set up the Java development environment:

1. Download the latest Java 5 SDK from http://java.sun.com (35 MB)

2. $sudo rpm -Uvh jdk-1_5_0_04-linux-i586.rpm

3. # ln -sf /usr/java/jdk1.5.0_04 /usr/local/java

We do this so that if a new Java version comes out, we can install the
RPM and only change the directory that the symlink points to. It's
more upgrade-friendly this way.

4. Edit /etc/profile and add the following lines:

export JAVA_HOME=/usr/local/java
export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar
export PATH=$JAVA_HOME/bin:$PATH

The jikes compiler requires that the CLASSPATH be set to the correct
directory. The "." entry lets us include classes which are in the same
directory. The last one adds our directory to the path.

You can also opt to put these lines in your .bashrc. But I prefer it
this way so that the changes are system-wide.

5. # alternatives --install /usr/bin/java java /usr/local/java/bin/java 3

The default java compiler is gcj. We use the alternatives system to
install our new Java setup without overwriting the previous gcj
settings. If we want to use gcj, we can easily switch to that one by
running # alternatives --config java

6. # alternatives --config java (then choose our new Java command)

Choose the one that is on the /usr/local/java directory.

-- 
Stand before it and there is no beginning.
Follow it and there is no end.
Stay with the ancient Tao,
Move with the present.