RE(4): NoClassDefFoundError (no Java 3D)

Hi David,

>I have been looking around the web as well, and one source said that it's
>good to delete the java.exe and javac.exe files that are copied into the
>system directory, because in that location (assuming the path statement
>directs there first) they won't find vecmath.jar and so on (though
>apparently this is fixed after version 1.2.2).

Java.exe is indeed copied to the Windows system folder.  Javac.exe is not.
I would not recommend deleting java.exe from the system folder.  Instead,
make sure your JDK's bin folder comes first in the path.

>Actually, I think I may have copied some *.dll and *.jar files into the
>system/profiles directory (from an older java version) to try to minimise
>path problems, but perhaps this is adding to a different problem.

You should never need to copy these files, and I can't predict what problems
you'll have once there are multiple copies of them floating around in different
folders.
 
>Perhaps another problem may be used by my use of case:
>"classpath" and "CLASSPATH" seem to be treated (at least partially) as
>different variables, and I was not so consistent :-p

Stick to "CLASSPATH" (all caps).  Works for me.

>C:\jdk1.3.1\demo\java3d\HelloUniverse>java HelloUniverse.class
>Exception in thread "main" java.lang.NoClassDefFoundError:
>HelloUniverse/class
>
>C:\jdk1.3.1\demo\java3d\HelloUniverse>java HelloUniverse.java
>Exception in thread "main" java.lang.NoClassDefFoundError:
>HelloUniverse/java

You will always get errors like this if you append ".java" or
".class" to the argument.  You must run "java HelloUniverse"
like you do below.

>C:\jdk1.3.1\demo\java3d\HelloUniverse>java HelloUniverse
>.
>wglCreateContext Failed: The operation completed successfully.
>
>extensionStr == null
>wglCreateContext Failed: The operation completed successfully.
>
>extensionStr == null

In the above case, Java is working, launching the program.
You are just having trouble with Java3D.  I'm not sure what's
the matter here... a reinstall of Java3D might help, or else
you could try Microsoft's software OpenGL drivers (but that
would result in poorer performance).

>C:\jdk1.3.1\demo\java3d\HelloUniverse>set CLASSPATH
>CLASSPATH=c:\visad.jar;.

Assuming you have visad.jar located in your root directory,
and are attempting to run VisAD applications from within
the jar file (such as the SpreadSheet), this CLASSPATH
looks good.  However, if you want to extract the VisAD
source files from visad_src-2.0.jar then that CLASSPATH
will not work.  See the VisAD FAQ installation instructions
for a detailed explanation of how to install the source code
version of VisAD.

>C:\jdk1.3.1\demo\java3d\HelloUniverse>appletviewer -J HelloUniverse.class
>Can't find class
>
>C:\jdk1.3.1\demo\java3d\HelloUniverse>appletviewer -J HelloUniverse
>Can't find class
>
>C:\jdk1.3.1\demo\java3d\HelloUniverse>appletviewer -J HelloUniverse.java
>Can't find class

Like I said before, appletviewer requires an HTML file for its argument.  It
will not work with .class or .java files, so the above will never work.  Don't
bother trying to test this stuff with appletviewer--just use java.exe.

>Actually I think my last install was of
>"java3d-1_2_1_01-win32-opengl-sdk.exe" - surely I don't also/instead need to
>install the J2 runtime environment separately?

You don't need to separately install the runtime environment (it installs
automatically when you install the JDK).  You installed JDK 1.3, and *then*
Java3D?  The latest versions of Java3D will autodetect where you have the
JDK installed, and put themselves there for you, nice and painlessly.

>OffsetUnit.java:138: Blank final variable 'scaledUnit' may not have been
>initial
>ized. It must be assigned a value in an initializer, or in every
>constructor.

Fix your other problems first, and if you still get these messages
upon compile, then I'll look into it.

>Now, I don't want you to get confused, so let me state that although I
>'unjarred' the visad *.java files to jdk1.2.1, the java that I (think) I am
>actually running at the moment is updated to the SDK 1.3.1, and OpenGL
>Java3D 1.2.1 SDK is also 'supposed' to be installed (it is certainly
>downloaded).

It is easier to unjar the VisAD source files to a neutral folder like "Java"
and run from there.

>> Don't even try to get a Java3D applet working in a web 
>> browser unless you
>> really know what you are doing. :-)  It is quite tricky.
>
>Trying to run (J3d) HelloUniverse in IE yields a (blank) grey square, with
>the message 
>"exception: java.lang.ClassNotFoundException: javax.media.j3d.Canvas3D" in
>the status line when the mouse hovers over the box.

That error means that IE can't find Java3D.  And it won't find it unless
you install the Java Plug-in first (not required for VisAD or Java3D outside
browsers).  The hard part about applets is getting Java3D or other
"extension" packages working within them properly.

>Just on this, attempting to open something like 
>"C:\jdk1.3.1\demo\java3d\HelloUniverse\HelloUniverse_plugin.html"
>(or a website that does not exist) brings up a dialogue/message box:
>"Your current security settingsprohibit running ActiveX controls on this
>page. As a result, the page may notdisplay correctly."

You can change these settings from the Tools menu, Internet Options
item, Security tab.  You'll be able to enable ActiveX controls, but it
still won't help you run Java3D applets from IE unless you install the
Java Plugin.

>P.S. Is it right that I can't run any of the test files that come with VisAD
>unless I compile them?   Are they in the visad.jar file?

By "test" files, I assume you mean the examples.  Yes, you must compile
the files first.  No, they are not included in visad.jar.

>I recently downloaded visad_examples.jar, but had not added it to my
>CLASSPATH.
>However it doesn't help me:

You need to use "jar xvf" to extract the visad_examples.jar file to its
own directory, then compile the source files that were extracted.
Do not change your CLASSPATH.

Overall, I think you are making things too difficult for yourself.  Just
start over, forget about using Java3D in a browser, and carefully
follow the installation instructions on the VisAD FAQ page.  Make
sure you follow either the visad.jar instructions, or the source code
instructions, and don't mix them up.  If you want to compile VisAD
from source and/or make changes to it, you'll need the source code
version.  If all you want to do is run the SpreadSheet and build your
own applications on top of VisAD, you can get away with the
visad.jar version.  But pick one, and follow the instructions carefully,
and let me know if you run into any snags.

-Curtis


  • 2001 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the visad archives: