Exception in thread "main" java.lang.NoClassDefFoundError in Java3D - java

I'm trying to develop a java3d application, i try everything, i just download the jogamp-platform because how i could read in many websites the java3d is obsolete and for mac os x you need this, i put them all in /System/Frameworks/Java/Extensions where are my .jar files in order to not add to the classpath in Eclipse but it still getting the same error:
Exception in thread "main" java.lang.NoClassDefFoundError: javax/media/opengl/AbstractGraphicsDevice
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:171)
at javax.media.j3d.Pipeline$1.run(Pipeline.java:143)
at java.security.AccessController.doPrivileged(Native Method)
at javax.media.j3d.Pipeline.createPipeline(Pipeline.java:138)
at javax.media.j3d.MasterControl.loadLibraries(MasterControl.java:926)
at javax.media.j3d.VirtualUniverse.<clinit>(VirtualUniverse.java:280)
at javax.media.j3d.Canvas3D.<clinit>(Canvas3D.java:3862)
at Apartado_a.<init>(Apartado_a.java:17)
at Apartado_a.main(Apartado_a.java:67)
Caused by: java.lang.ClassNotFoundException: javax.media.opengl.AbstractGraphicsDevice
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at sun.misc.Launcher$ExtClassLoader.findClass(Launcher.java:229)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
... 10 more
These are the files inside extensions folder:
j3daudio.jar
j3dcore.jar
j3dutils.jar
joal-natives-macosx-universal.jar
jogl-all.jar
gluegen-rt.jar
gluegen-rt-natives-macosx-universal.jar
Regards!

Mac OS X comes pre-installed with Java 3D version 1.3. You can find these files in /System/Library/Java/Extensions. If you need to install Java 3D version 1.5 (and it sounds like you do), then you can use this installer: http://create.ife.no/vr/tools/j3d/java3d_1_5_2-macosx.pkg.zip

Don't use the /System/Frameworks/Java/Extensions folder for this.
Instead, include the relevant libraries in the lib/ folder of your application. Also, check which version of the JDK you are using. I believe there are some issues with Java3D running on the newer Apple-provided JVMs versus the older Oracle/Sun provided ones.

Related

Java communication with JavaDB classNotFoundException

I'm trying to make a Java program that can communicate with JavaDB. I've made the Database class, started a server and made a tiny client program to check if they would communicate.
The program crashes when i try to run it, giving a class not found exception at the line where i try to set the database driver. I googled it and found that this error appears if derbyclient.jar and derby.jar are not found in the classpath. I also read that the scripts setNetworkClientCP and setNetworkServerCP found in the db directory would set these in the classpath. I found the scripts, ran them, and checked to make sure the classpath got updated, but i still get the same error. Does anyone know what the problem might be?
EDIT: SOLVED - i just realized that i need to include the derbyclient.jar in the NetBeans project library.
I'm using NetBeans and the built in JavaDB. I set the classpath by using the scripts that i mentioned above, and upon checking the classpath i found these entries:
%DERBY_INSTALL%\lib\derbyclient.jar;
%DERBY_INSTALL%\lib\derby.jar;
%DERBY_INSTALL%\lib\derbytools.jar;
%DERBY_INSTALL%\lib\derbynet.jar;
The Error:
java.lang.ClassNotFoundException: org.apache.derby.jdbc.ClientDriver
at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:260)
at Database.<init>(Database.java:14)
at TestKlient.main(TestKlient.java:8)

Java3D classes not found

I'm trying to run a Java application and I get the following error message. The application itself loads correctly, it just appears to be certain parts of it that fail.
Nov 13, 2012 2:43:53 PM org.jdesktop.application.Task failed
SEVERE: My.Application$9#7c4f8358 failed: java.lang.NoClassDefFoundError: javax/media/opengl/GLCapabilitiesChooser
java.lang.NoClassDefFoundError: javax/media/opengl/GLCapabilitiesChooser
at jpl.mipl.jade.jadis.agile2d.swing.JOGLPluggableRenderer.notifyBeforeSetRootPane(JOGLPluggableRenderer.java:105)
at jpl.mipl.jade.jadis.StereoJFrame.setRootPane(StereoJFrame.java:264)
at javax.swing.JFrame.frameInit(JFrame.java:236)
at javax.swing.JFrame.<init>(JFrame.java:159)
at jpl.mipl.jade.jadis.StereoJFrame.<init>(StereoJFrame.java:172)
at StereoWS.DSStereoFrame.<init>(DSStereoFrame.java:70)
at StereoWS.StereoWSView$9.doInBackground(StereoWSView.java:1067)
at org.jdesktop.swingworker.SwingWorker$1.call(Unknown Source)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at org.jdesktop.swingworker.SwingWorker.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:680)
Caused by: java.lang.ClassNotFoundException: javax.media.opengl.GLCapabilitiesChooser
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
... 14 more
I'm running OS X 10.8 fully updated, I've installed JDK 7 and, in frustration, Apple's Java development tools. The program relies on a number of external libraries, but these are supplied with the jar and I trust that the program does actually look for them in the distribution directory when it runs (the errors aren't due to those packages though, I believe). As far as I can tell everything that I need to run the application is either already installed or somewhere where the jar can find it
I don't know if there's anything else I need to do to set up the environment that I haven't done yet, so if anyone can suggest something, I'm all ears! I will provide any extra information needed, but I don't know what would help - I'm not a Java guru by any means.
I believe you are using Java3D jars from the old Oracle site in combination with the latest JogAmp JOGLv2, this will not work of two reasons A) the jogl.jar is now renamed jogl-all.jar B) internal namespace changes, all com.sun.* classes is now found under com.jogamp.* and this will confuse the old Java3D code that expects the com.sun.* namespace.
Both JOGL and Java3D is now maintained by members of the JogAmp community:
Background of the move: http://labb.zafena.se/?p=656
The only supported way to use Java3D today is by using the community maintained Java3D in combination with the latest JogAmp JOGL v2.
Tutorial on how to setup the latest community maintained Java3D in combination with JOGLv2.
Julien Gouesse: Java 3D est de retour [Java 3D is back]
http://gouessej.wordpress.com/2012/08/01/java-3d-est-de-retour-java-3d-is-back/

Conflict with bluecove library

I have a big problem according to the bluecove library which I am trying to use in an ANT project.
My project is a platform which receive messages from different agents, such as TCP agents, SunSpot agents (which use UDP), and now I'm trying to set bluetooth agents.
For this purpose is required the bluecove library, but result in conflict with javax.microedition.io used for example in the UDP classes that I'm implementing.
I guess that it's a library conflict, I have tried to put the bluecove-2.1.1 jar into the jdk1.6_xx/jre/lib/ext but this throws an exception in the UDP classes:
Error checking for shared basestation: javax.microedition.io.ConnectionNotFoundException: radiogram
javax.microedition.io.ConnectionNotFoundException: udp
javax.microedition.io.ConnectionNotFoundException: udp
at com.intel.bluetooth.MicroeditionConnector.openImpl(MicroeditionConnector.java:185)
at com.intel.bluetooth.MicroeditionConnector.open(MicroeditionConnector.java:162)
at javax.microedition.io.Connector.open(Connector.java:83)
at org.sunspotworld.SunSpotListener.run(SunSpotListener.java:48)
However if I remove from the content of bluecove2.1.1 jar the folder javax/microedition the error thrown is completely different:
Exception in thread "main" java.lang.NoClassDefFoundError: javax/microedition/io/Connection
Exception in thread "main" java.lang.NoClassDefFoundError: javax/microedition/io/Connection
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:169)
at com.intel.bluetooth.Utils.class$(Utils.java:44)
at com.intel.bluetooth.Utils.<clinit>(Utils.java:44)
at javax.bluetooth.UUID.<init>(UUID.java:224)
at org.sunspotworld.BTListener.<clinit>(BTListener.java:28)
at org.sunspotworld.SunSpotHostApplication.run(SunSpotHostApplication.java:67)
at org.sunspotworld.SunSpotHostApplication.main(SunSpotHostApplication.java:342)
Caused by: java.lang.ClassNotFoundException: javax.microedition.io.Connection
Caused by: java.lang.ClassNotFoundException: javax.microedition.io.Connection
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at sun.misc.Launcher$ExtClassLoader.findClass(Launcher.java:229)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
... 8 more
... 8 more
I have read some solution involving xbootclasspath/a but I have no any idea what is that o how I can manage it...
Edit: I have used Xboothclasspath/a and /p to add the bluecove jar route, and the only thing I got was the chance to remove the jar import from my NetBeans project. Still not working. =(
Thank you very much in advance !!
I don't know why you decided this error is caused by a conflict between the two libs as i don't see any mention to this in the error.
The second error (after removing the lib) simply states that it can't find the required classes (which is logical since you removed them :) ).
I'd suggest you check that the firewall is not blocking you.

Play! Framework run throws UnsupportedClassVersionError

Background, this application is running on Play! Framework 1.2.4 on a Mac OS X 10.5.8
The command I'm running: sudo play run
The exception thrown:
Exception in thread "main" java.lang.UnsupportedClassVersionError: Bad version number in .class file
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:676)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:317)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:280)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:375)
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2357)
at java.lang.Class.getConstructor0(Class.java:2671)
at java.lang.Class.newInstance0(Class.java:321)
at java.lang.Class.newInstance(Class.java:303)
at play.plugins.PluginCollection.loadPlugins(PluginCollection.java:158)
at play.Play.init(Play.java:294)
at play.server.Server.main(Server.java:158)
The application.conf for the application and all dependent modules are set to java.source=1.6
sudo $JAVA_HOME/bin/java -version yields java version "1.6.0_26"
I've even pointed /System/Java/Home to the 1.6 installation.
What else could be causing this?
Which Java version(s) do you have in your PATH? We got a similar issue (not with Play, though) in which all the settings of the application seemed to point to 1.6 but the PATH had a reference to 1.5 that was loaded first due to its position inside the PATH string.
Check your PATH. And, I'm not a Mac user, but it's necessary to use sudo? In Ubuntu I run Play without. If possible, this may help to reduce unexpected conflicts due to root user paths and configuration.

How do I add a .jar file to the classpath on Mac OS X?

I'm starting to become pretty irritated, because EVERY time I try to add a JAR file to the classpath to run a program (which compiles fine in Eclipse) I get a "java.lang.NoClassDefFoundError" exception.
The file swt.jar and GUI.class (main class) are in the same directory. If I issue this command: "java -cp swt.jar GUI", I get this error message:
Exception in thread "main" java.lang.NoClassDefFoundError: GUI Caused
by: java.lang.ClassNotFoundException: GUI at
java.net.URLClassLoader$1.run(URLClassLoader.java:202) at
java.security.AccessController.doPrivileged(Native Method) at
java.net.URLClassLoader.findClass(URLClassLoader.java:190) at
java.lang.ClassLoader.loadClass(ClassLoader.java:306) at
sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at
java.lang.ClassLoader.loadClass(ClassLoader.java:247)
If I formulate the command like this: "java GUI -cp swt.jar", it'll throw this exception:
Exception in thread "main" java.lang.NoClassDefFoundError:
org/eclipse/swt/widgets/Display at GUI.main(GUI.java:9) Caused by:
java.lang.ClassNotFoundException: org.eclipse.swt.widgets.Display at
java.net.URLClassLoader$1.run(URLClassLoader.java:202) at
java.security.AccessController.doPrivileged(Native Method) at
java.net.URLClassLoader.findClass(URLClassLoader.java:190) at
java.lang.ClassLoader.loadClass(ClassLoader.java:306) at
sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at
java.lang.ClassLoader.loadClass(ClassLoader.java:247) ... 1 more
I just want to know how I can add .jar files to the runtime classpath on mac.
All of these commands are being issued from the Terminal on a 64-bit MacBook running Mac OS X Lion.
The problem, I think, is that you are specifying swt.jar as the classpath, but the file you're using is not in the jar. You neeed to specify both the jar and this dir as the classpath.
e.g.
java -cp swt.jar:./ GUI
This one will work, with modifications:
If I formulate the command like this: "java GUI -cp swt.jar"
You just didn't go far enough. You have to add ALL the 3rd party JARs, including the ones for Eclipse SWT and all your other dependencies.

Categories

Resources