new install, CLASSPATH issue on CentOS

I spent all night on this one and have gotten no where!

Download the j2sdk1.4.2_04.bin

(mine is in the /download directory)

Chmod 755

./ j2sdk1.4.2_04.bin

mv the directory to its chosen home (I choose /usr/java/)

I have 2 versions in this directory and have tried both

j2sdk1.4.2_04/ j2sdk1.4.2_15/

(both versions tried with same result)

Set the environment variables

PATH=/usr/java/j2sdk1.4.2_04/bin:$PATH

export PATH

export JAVA_HOME=/usr/java/j2sdk1.4.04

export CLASSPATH=/usr/java/j2sdk1.4.2_04/lib/tools.jar:/usr/java/j2sdk1.4.2_04/jre/lib/rt.jar

(The last one it says you may have to end it with :. I have tried both ways.)

Here is my env

root@cdillon [/usr/java]# env

MANPATH=/usr/lib/courier-imap/man:

SHELL=/bin/bash

TERM=xterm

HISTSIZE=1000

OLDPWD=/downloads

LS_COLORS=no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.avi=01;35:*.fli=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.ogg=01;35:*.mp3=01;35:*.wav=01;35:

PATH=/usr/java/j2sdk1.4.2_04/bin:/usr/java/j2sdk1.4.2_15/bin:/downloads/j2sdk1.4.2_15/bin:/usr/local/jdk/bin:/usr/kerberos/bin:/usr/lib/courier-imap/bin:/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/usr/local/bin:/usr/X11R6/bin

MAIL=/var/spool/mail/cdillon

PWD=/usr/java

INPUTRC=/etc/inputrc

JAVA_HOME=/usr/java/j2sdk1.4.04

EDITOR=pico

LANG=C

HOME=/root

SHLVL=2

LS_OPTIONS=--color=tty -F -a -b -T 0

LOGNAME=cdillon

VISUAL=pico

CLASSPATH=/usr/java/j2sdk1.4.2_04/lib/tools.jar:/usr/java/j2sdk1.4.2_04/jre/lib/rt.jar:./

LESSOPEN=|/usr/bin/lesspipe.sh %s

G_BROKEN_FILENAMES=1

_=/bin/env

So, they are there!

And then run the test script!

And here is my error;

root@cdillon [/usr/java]# /usr/java/j2sdk1.4.2_04/bin/java Test

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

Any thoughts my friends?

[2412 byte] By [bcddd214a] at [2007-11-27 11:18:44]
«« Eyes
»» Upload Image
# 1

(1) Don't install multiple versions of JDK.

(2) Forget CLASSPATH. Delete the environment entry.

--Sun's install guide page, http://java.sun.com/j2se/1.4.2/install-linux.html, has no mention on CLASSPATH because it is not only useless but also harmful sometimes.

For general classpath issue, read the documentation for java and javac tools.

hiwaa at 2007-7-29 14:32:44 > top of Java-index,Java Essentials,New To Java...
# 2

Very good point!

and I was able to use

java -verbose

and found a whole slue of errors.

I think I have gotten passed most of the errors and still have the same error (it did change to a VM error temporaily) but back to the same one.

Main error

java -classpath

*** glibc detected *** free(): invalid next size (fast): 0x08059008 ***

Aborted

symptom error

/usr/java/j2sdk1.4.2_04/bin/java TestException in thread "main" java.lang.NoClassDefFoundError: Test

enviroment variables

env

SHELL=/bin/bash

PATH=/usr/kerberos/bin:/usr/lib/courier-imap/bin:/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/usr/local/bin:/usr/X11R6/bin:/usr/local/j2sdk1.4.2_05/bin/

JAVA_HOME=/usr/local/j2sdk1.4.2_05

EDITOR=pico

LANG=C

HOME=/root

SHLVL=2

CLASSPATH=/usr/local/j2sdk1.4.2_05/lib/tools.jar:/usr/local/j2sdk1.4.2_05/jre/lib/rt.jar:.

x=/usr/local/j2sdk1.4.2_05/bin/

G_BROKEN_FILENAMES=1

_=/bin/env

java -Xmx4m -version(changing -Xmx4-32m are all good)

java version "1.4.2_05"

Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_05-b04)

Java HotSpot(TM) Client VM (build 1.4.2_05-b04, mixed mode)

What could I be missing now?

What is the

java -classpath

*** glibc detected *** free(): invalid next size (fast): 0x08059008 ***

Aborted

refering to, and why still getting the

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

error?

bcddd214a at 2007-7-29 14:32:44 > top of Java-index,Java Essentials,New To Java...
# 3

This is what got me from the VM error back to the existing errors.

I did it differentl before, but this should have corrected it.

# rm /var/lib/alternatives/java

rm: remove regular file `/var/lib/alternatives/java'? y

# /usr/sbin/alternatives --install /usr/bin/java java /usr/lib/jvm/j2sdk1.4.2_05/bin/java 1

root@cdillon [/usr/java]# /usr/sbin/alternatives --config java

There are 1 programs which provide 'java'.

SelectionCommand

--

*+ 1/usr/lib/jvm/j2sdk1.4.2_05/bin/java

Enter to keep the current selection[+], or type selection number: 1

/usr/sbin/alternatives --display java

java - status is manual.

link currently points to /usr/lib/jvm/j2sdk1.4.2_05/bin/java

/usr/lib/jvm/j2sdk1.4.2_05/bin/java - priority 1

Current `best' version is /usr/lib/jvm/j2sdk1.4.2_05/bin/java.

bcddd214a at 2007-7-29 14:32:44 > top of Java-index,Java Essentials,New To Java...
# 4

Uninstall the GNU Java from your Linux distro and suppress the Java related entries in /etc/alternatives/ directory.

Try:

which javac

which java

hiwaa at 2007-7-29 14:32:44 > top of Java-index,Java Essentials,New To Java...