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 #
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
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
On 31 Aug 2005 12:11:28 -0700, tony_linc...@yahoo.com wrote:
> 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
-- [ do not email me copies of your followups ] g o r d o n + n e w s @ b a l d e r 1 3 . s e
On 1 Sep 2005 01:58:06 -0700, tony_linc...@yahoo.com wrote:
> 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
-- [ do not email me copies of your followups ] g o r d o n + n e w s @ b a l d e r 1 3 . s e
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?
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, 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
tony_linc...@yahoo.com wrote: > 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.
tony_linc...@yahoo.com wrote: > 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.