path setting in Linux for java3d

T

tony_lincoln

Dear Friends,
I am new in Linux although I wrote Java codes under windows for some
times. Question here:

I tried to run java 3d in Linux, here is the steps:

1. download the following 4 files which are necessary for the
installation:
java3d-re-1.3-beta2-linux-i386.bin
java3d-sdk-1.3-beta2-linux-i386.bin
LICENSE-Java3D-1.3-beta2.txt
README-Java3D-1.3-beta2.txt


2.become root:
% su root
Password: enter root password
#

3. bash java3d-re-1.3-beta2-linux-i386.bin
yes
bash java3d-sdk-1.3-beta2-linux-i386.bin

4. exit the root.

5. demo/java3d/HelloUniverse$ java HelloUniverse
Exception in thread "main" java.lang.NoClassDefFoundError:
javax/media/j3d/Node

WHen I tried to run HelloUniverse, there is error:
NoClassDefFoundError: javax/media/j3d/Node.

I am sure that this is the problem of path setting. But how?
Thanks a lot for your hints.

btw. I guess that I should post this question into
comp.lang.java.java3d. But there are much less visitor there and I
always can not get answer. So I have to post this question here. Sorr.y
tony
 
G

Gordon Beaton

WHen I tried to run HelloUniverse, there is error:
NoClassDefFoundError: javax/media/j3d/Node.

I am sure that this is the problem of path setting. But how?
Thanks a lot for your hints.

You should be in the jre root (e.g. $JAVA_HOME/jre) when you do your
step 3, so the jarfiles end up in $JAVA_HOME/jre/lib/ext.

/gordon
 
T

tony_lincoln

sorry for my stupid quesiton here:
How do I know where JAVA_HOME is? which command? I know how it works in
WIndows, but not Linux...
THanks a lot.
Tony
 
G

Gordon Beaton

How do I know where JAVA_HOME is? which command? I know how it works
in WIndows, but not Linux...

$JAVA_HOME should refer to the top level directory of your JDK
installation. Where did you install the JDK?

"echo $JAVA_HOME" will tell you the value of JAVA_HOME, if there is
such a variable (there might not be one).

Or try typing "type -a javac" to find out where to start looking for
the JDK. Javac *should* be in the bin directory of your JDK, but it
*could* be somewhere else, for example if it's a symbolic link.

/gordon
 
T

tony_lincoln

Thank you very much! $JAVA_HOME is ~/java/j2sdk1.4.2_08, I tried the
following:

rakta:~/java/j2sdk1.4.2_08/demo/java3d/HelloUniverse$ javac
HelloUniverse.java
rakta:~/java/j2sdk1.4.2_08/demo/java3d/HelloUniverse$ java
HelloUniverse
Exception in thread "main" java.lang.NoClassDefFoundError:
javax/media/j3d/Node

This means, javac can work, but java can not. Shall I set some
classpath?
Thanks in advance!
tony.
 
G

Gordon Beaton

This means, javac can work, but java can not. Shall I set some
classpath?

Sorry I didn't notice that you downloaded both java3d-sdk and
java3d-re. These packages unpack into slightly different paths, and
consequently you need to be in a different place when you unpack them.

The jar files should end up in $JAVA_HOME/jre/lib/ext, as I mentioned
earlier, and the library (.so) files in $JAVA_HOME/jre/lib/i386. If
the files are there, then both javac and java should work.

To unpack java3d-sdk, you should be in JAVA_HOME (the root dir of your
JDK).

To unpack java3d-re, you should be in JAVA_HOME/jre. Note that if you
already unpacked the sdk, you don't need the jre.

/gordon
 
T

tony_lincoln

I did the following:
1. unpack java3d-re in JAVA_HOME/jre.
2. Then I tried:
rakta:~/java/j2sdk1.4.2_08/demo/java3d/HelloUniverse$ java
HelloUniverse
Exception in thread "main" java.lang.NoClassDefFoundError:
javax/media/j3d/Node

Still the same error. This means that java can not find the package
javax.
3. Then I set:
export CLASSPATH=./:$HOME/.lib:$JAVA_LOCAL/lib:$JAVA_HOME/jre/lib/ext
$JAVA_HOME/jre/lib/ext is where jar files stays. But it still can not
work.
Why?
 
C

Chris Uppal

rakta:~/java/j2sdk1.4.2_08/demo/java3d/HelloUniverse$ java
HelloUniverse
Exception in thread "main" java.lang.NoClassDefFoundError:
javax/media/j3d/Node

I wonder if "java" is finding the wrong java installation. As far as I know,
setting the CLASSPATH isn't necessary for properly installed java "extensions"
(javax.* packages). You could try typing:

type java

if that doesn't reply something like:

java is <somewhere>/bin/java

where the <somewhere> is a java installations that you've added the 3d
extensions to, then that would (I think) explain what's going wrong. That
could happen if you have a JRE installed (without the 3d stuff) earlier on your
classpath than the JDK (with the 3d stuff) -- in that case "javac" would find
the right compiler, but "java" would find the wrong java runtime.

-- chris
 
T

tony_lincoln

Thanks. I tried typing:

rakta:~$ type java
java is /usr/bin/java

so /usr is a java installation. You mean that JRE (without the 3d
stuff) and JDK (with the 3d stuff) were installed in the different path?
 
T

tony_lincoln

Chris, you are right. Actually in this computer JRE (without the 3D
stuff) was installed earlier by someone whom I do not know, then I
istall the java3D. I guess that in this case "java" found the wrong
java runtime. So should I reintall the whole JDK, JRE and java3D? I
even do not know how to disinstall all these stuff...
Tony
 
C

Chris Uppal

Chris, you are right. Actually in this computer JRE (without the 3D
stuff) was installed earlier by someone whom I do not know, then I
istall the java3D. I guess that in this case "java" found the wrong
java runtime. So should I reintall the whole JDK, JRE and java3D?

Bit late now, but FWIW, I would either add the 3s stuff to the "earlier" JRE
(if it's a late enough release of Java that you are happy to use it) or change
my $PATH and so on to exclude it from my environment.

I don't have any real experience of Java on Unix-like systems, but I've never
yet seen Unix system where the software installation wasn't a complete mess. I
generally find it easier (at least in the short term) to side-step the mess
than fix it.

-- chris
 
T

tony_lincoln

So I have to distall all java JRE and SDK, then install them and java3D
again?
But how to distall java JRE and SKD? which command?
Thanks!
 
C

Chris Uppal

So I have to distall all java JRE and SDK, then install them and java3D
again?
But how to distall java JRE and SKD? which command?

Personally, I'd just leave them in place and ensure that my $PATH (as well as
any Java-specific environment variables) did not point to the installations I
didn't want to use.

If you don't know what the $PATH is, or how to set enviroment variables, then
that's rather too big a topic for a newsgroup posting (especially in a Java
ng), and I suggest you get a good introductory book on Unix and/or Linux.

-- chris
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top