Trying to set up JAVA on Linux

Hi Everyone,

I just freshly built a FC5 box to do java development on. It installed the following packages during installation:

java-1.4.2-gcj-compat-1.4.2.0-40jpp_83rh

java-1.4.2-gcj-compat-devel-1.4.2.0-40jpp_83rh

java-1.4.2-gcj-compat-src-1.4.2.0-40jpp_83rh

java_cup-0.10-0.k.1jpp_9fc

java_cup-javadoc-0.10-0.k.1jpp_9fc

java_cup-manual-0.10-0.k.1jpp_9fc

This one, java-1.4.2-gcj-compat-devel has the java utilities, javac, java etc etc. However, now i've downloaded jdk-1_5_0_07-linux-i586 from sun.com and it's installed.

Now when I type javac -v it says this:

Eclipse Java Compiler v_585_R31x, 3.1.2 release, Copyright IBM Corp 2000, 2006. All rights reserved.

I think it's running /usr/bin/javac which is part of the java-1.4.2-gcj-compat-devel.

I don't know what version it's using. I tried to remove v 1.4.2, but it says ant relies on it, which is part of apache.

Also, I know my classpath should be ".", do I need to set up any other environment variable.

Can someone who's been through this before please give me some guidance? Thanks :)

[1144 byte] By [samuuraia] at [2007-10-3 2:13:36]
# 1
Can't you just export your PATH to point to the Java installation that you want?
tieflinga at 2007-7-14 19:12:27 > top of Java-index,Java Essentials,New To Java...
# 2
Then i'll have two javac programs in my paths because i can't really remove the path to /usr/bin :)I'm wondering if I should force remove the devel package....Message was edited by: samuurai
samuuraia at 2007-7-14 19:12:27 > top of Java-index,Java Essentials,New To Java...
# 3
But if the javac that you want to use 1.5 comes first in your path, then what's the problem?
tieflinga at 2007-7-14 19:12:27 > top of Java-index,Java Essentials,New To Java...
# 4
Oh, is that how it works.....Thanks!Also, do I have to put anything else in my path? I found lots of documents with conflicting information. Do I need a JAVA_HOME? do I need to path to /java/lib ?
samuuraia at 2007-7-14 19:12:27 > top of Java-index,Java Essentials,New To Java...
# 5

I've got that sorted, it's using the correct version now.

However, i'm getting another issue now:

[root@berenlinux beren]# java Test.class

Exception in thread "main" java.lang.NoClassDefFoundError: Test/class

[root@berenlinux beren]#

i've tried CLASSPATH= <- nothing and CLASSPATH=.

samuuraia at 2007-7-14 19:12:27 > top of Java-index,Java Essentials,New To Java...
# 6
run java Testnotjava Test.class
tieflinga at 2007-7-14 19:12:27 > top of Java-index,Java Essentials,New To Java...
# 7
Oh...*slap's forehead*Thanks mate.. :)
samuuraia at 2007-7-14 19:12:27 > top of Java-index,Java Essentials,New To Java...
# 8
:), np
tieflinga at 2007-7-14 19:12:27 > top of Java-index,Java Essentials,New To Java...
# 9
> Then i'll have two javac programs in my paths because> i can't really remove the path to /usr/bin :)Under most distros, /usr/bin/java is just a symlink to somewhere else on the filesystem. You may be able to just repoint this link to Sun's jdk.
bckrispia at 2007-7-14 19:12:27 > top of Java-index,Java Essentials,New To Java...