Java 3D in eclipse Mac OSX not functioning

classic Classic list List threaded Threaded
63 messages Options
1234
Reply | Threaded
Open this post in threaded view
|

Java 3D in eclipse Mac OSX not functioning

CMBR
This post was updated on .
So I recently made the switch to Mac OS X 10.9.4 from windows and I am trying to recompile a program I made with Java3D API in eclipse and I am getting the following errors:

JavaVM WARNING: JAWT_GetAWT must be called after loading a JVM
AWT not found
(-5, 12, -1)
Exception in thread "main" java.lang.NoClassDefFoundError: apple/awt/CGraphicsDevice
        at javax.media.j3d.GraphicsConfigTemplate3D.<clinit>(GraphicsConfigTemplate3D.java:55)
        at com.sun.j3d.utils.universe.SimpleUniverse.getPreferredConfiguration(SimpleUniverse.java:368)
        at com.sun.j3d.utils.universe.Viewer.<init>(Viewer.java:348)
        at com.sun.j3d.utils.universe.Viewer.<init>(Viewer.java:298)

etc...

I have tried using this guide at:
http://gouessej.wordpress.com/2012/08/01/java-3d-est-de-retour-java-3d-is-back/

I do everything that is mentioned there, however I am not entirely sure how I am supposed to deal with my class path? How can I change this or even see what it currently is via the terminal?

EDIT: My program was designed a while ago in Java3D 1.5.1 I think, is it possible for me to somehow get it to compile on the latest MacOSX or would windows BootChamp be the only workaround?

Cheers
Reply | Threaded
Open this post in threaded view
|

Re: Java 3D in eclipse Mac OSX not functioning

Wade Walker
Administrator
CMBR wrote
So I recently made the switch to Mac OS X 10.9.4 from windows and I am trying to recompile a program I made with Java3D API in eclipse and I am getting the following errors:

JavaVM WARNING: JAWT_GetAWT must be called after loading a JVM
AWT not found
One thing to try might be adding "-Djava.awt.headless=true" to the JVM options, which is required on Mac but not on PC. This prevents AWT from being started during some library calls and messing up the JVM. I mention it briefly in my tutorial at http://wadeawalker.wordpress.com/2010/10/09/tutorial-a-cross-platform-workbench-program-using-java-opengl-and-eclipse/.
Reply | Threaded
Open this post in threaded view
|

Re: Java 3D in eclipse Mac OSX not functioning

gouessej
Administrator
This post was updated on .
Hi

Wade, how can it impact Swing applications?

Edit.: CMBR, please use Oracle JVM (or OpenJDK). We don't support Apple JVM. I wrote "put those whose name does not contain the word "natives" into the classpath", I don't see what isn't crystal clear in my tutorial.

Edit.2: CMBR, this kind of exception is often thrown when your program still uses an old version of Java 3D:
http://stackoverflow.com/questions/12738469/java3d-not-working-on-mac-mountain-lion
http://bugs.java.com/view_bug.do?bug_id=7124557

Edit.3: What is missing in my tutorial? It talks about the Java Build Path of Eclipse. What more can I do? Please read my tutorial carefully.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Java 3D in eclipse Mac OSX not functioning

CMBR
@Wade Walker: After following through to “Run As > Run Configurations…”  “Eclipse Application > there were no configurations"

So I created a new configuration and added the -Djava.awt.headless=true to the JVM options, ran the configuration and tried to compile but I got the same error unfortunately.

@Julien: I installed the Oracle Java JRE 7 and JDK 7, not sure about the JVM though? I only found jvmstat on the Oracle website?

As for the class path I managed to add the jars in the terminal with CLASSPATH=$CLASSPATH:.. Like I say I am new to MacOS, still getting to grips with the basics. Anyway this did not help and I get the same error.

Lastly the 1st link you posted says "I'm afraid that Java3D 1.5 is incompatible with newer versions of OSX, there's nothing you can do." My program was developed on Java3D1.5 a while back so does this mean there is nothing I can do for real? I mean I added the Java3D 1.6 on your tutorial to my class path + eclipse project build path along with the jars in that .7z compressed file as stated in the tutorial.
Reply | Threaded
Open this post in threaded view
|

Re: Java 3D in eclipse Mac OSX not functioning

gouessej
Administrator
Ok, sorry, this is not what I meant, use "java -cp" in command line or the Java Build Path when you need to modify the classpath, don't use platform-dependent environment variables. There is a reason why I never mention those environment variables in my tutorial.

Oracle Java JRE 7 works.

As you still get the same error, there is still an old version of Java3D (1.5?) installed on your machine as the latest version (1.6) does NOT use apple.awt.* classes. Please read carefully my tutorial, I mention the most common directories in which you might find Java3D installed as an extension. I use OS X only several times a year, I understand your difficulties but I try to keep my tutorial far from unnecessary particularities of each OS.

As Harvey wrote in 2012, Java3D 1.6 is completely compatible with Java3D 1.6. There is no hidden meaning, he meant that it isn't possible to make your program work with Java3D 1.5 under newer versions of OS X whereas it is obviously possible with Java3D 1.6. Please uninstall Java3D 1.5 as advised in my tutorial. Then, everything should work, don't tinker $CLASSPATH. As long as Java3D 1.5 is installed as an extension, it will be loaded in priority by any program.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Java 3D in eclipse Mac OSX not functioning

CMBR
Ok thanks for the clarifications, will report back if I fix it successfully.
Reply | Threaded
Open this post in threaded view
|

Re: Java 3D in eclipse Mac OSX not functioning

gouessej
Administrator
This post was updated on .
I've updated my tutorial.

It just works. I can even use Java 3D 1.6 with OpenJDK 7 and Mac OS X 10.7 and later without trouble. I'm 100% sure that JOGL 2 doesn't use apple.awt.* classes.

I'm impatient to get your feedback anyway.

Edit.: I modified my tutorial to mention several "common" troubles. I hope it is more understandable now. I assume that Java 3D 1.5.1 is still installed somewhere on your machine. You said you did everything I mentioned in my tutorial but I wrote that you have to uninstall obsolete versions of Java 3D especially under Mac. You wrote that you don't know how to deal with your classpath whereas it was already explained but I created several subsections so that anybody can quickly knows what to do to compile and run a program in command line and with an IDE (including Eclipse of course). You can still try the workaround that "ignores" the extensions too.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Java 3D in eclipse Mac OSX not functioning

CMBR
Unfortunately I have tried searching all over and can't find any loose Java3D 1.5 .jars, I have tried placing the 1.6 pre release .jars in different places with no luck, really no idea how to get rid of Java3D 1.5, when you say set java.ext.dirs, you mean  java -Djava.ext.dirs=/foo/bar/baz:/bleem/grumpf MyApp right?

EDIT: I get the following in the terminal,
craigs-mbp:bin Craig$  java -Djava.ext.dirs="" Main
Exception in thread "main" java.lang.NoClassDefFoundError: javax/media/j3d/Node
        at java.lang.Class.getDeclaredMethods0(Native Method)
        at java.lang.Class.privateGetDeclaredMethods(Class.java:2570)
        at java.lang.Class.getMethod0(Class.java:2813)
        at java.lang.Class.getMethod(Class.java:1663)
        at sun.launcher.LauncherHelper.getMainMethod(LauncherHelper.java:494)
        at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:486)
Caused by: java.lang.ClassNotFoundException: javax.media.j3d.Node
        at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
        ... 6 more
Reply | Threaded
Open this post in threaded view
|

Re: Java 3D in eclipse Mac OSX not functioning

gouessej
Administrator
There are several directories mentioned in my tutorial that may contain Java3D 1.5. I'm sorry but Java3D 1.6 doesn't use apple.awt for sure. If you don't set the classpath with -cp when using the "java" command like I indicated in my tutorial, it will never work. I spent 2 hours in clarifying it as much as I could.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Java 3D in eclipse Mac OSX not functioning

CMBR
I tried that and I get this error:

craigs-mbp:bin Craig$ java -cp gluegen-rt.jar:j3dcore.jar:j3dutils.jar:joal.jar:jogl-all.jar:vecmath.jar Main
Error: Could not find or load main class Main

even though I am in the directory with the class.. =/ I don't really get what [1] (my JAR) is supposed to be?
Reply | Threaded
Open this post in threaded view
|

Re: Java 3D in eclipse Mac OSX not functioning

gouessej
Administrator
In reply to this post by CMBR
Just put all JARs into the current directory in which you are when you run the main method of your "Main" class, go on using java.ext.dirs and use -cp exactly like in the tutorial and it will work. Please strictly follow the instructions. Don't copy the JARs of Java3D everywhere, you might just break your environment.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Java 3D in eclipse Mac OSX not functioning

gouessej
Administrator
In reply to this post by CMBR
Use . to indicate that you want to use the class in your current directory instead of a JAR.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Java 3D in eclipse Mac OSX not functioning

CMBR
All .Jars are "only" in the same directory as my Main.class and I run the java commands as so

craigs-mbp:bin Craig$ java -cp gluegen-rt.jar:j3dcore.jar:j3dutils.jar:joal.jar:jogl-all.jar:vecmath.jar: Main -Djava.ext.dirs="" Main
JavaVM WARNING: JAWT_GetAWT must be called after loading a JVM
AWT not found
(-11, 2, -5)
Exception in thread "main" java.lang.NoClassDefFoundError: apple/awt/CGraphicsDevice
        at javax.media.j3d.GraphicsConfigTemplate3D.<clinit>(GraphicsConfigTemplate3D.java:55)
        at com.sun.j3d.utils.universe.SimpleUniverse.getPreferredConfiguration(SimpleUniverse.java:368)
        at com.sun.j3d.utils.universe.Viewer.<init>(Viewer.java:348)
        at com.sun.j3d.utils.universe.Viewer.<init>(Viewer.java:298)
        at com.sun.j3d.utils.universe.SimpleUniverse.<init>(SimpleUniverse.java:215)
        at com.sun.j3d.utils.universe.SimpleUniverse.<init>(SimpleUniverse.java:177)
        at com.sun.j3d.utils.universe.SimpleUniverse.<init>(SimpleUniverse.java:88)
        at Main.main(Main.java:170)
Caused by: java.lang.ClassNotFoundException: apple.awt.CGraphicsDevice
        at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
        ... 8 more

Really not seeing what i'm missing from your tutorial, I appreciate your telling me that it simply won't run with Java3D 1.5 but I have only been using the jars from your tutorial and can't find any other jars which could be 1.5 anywhere, I also can't see the directories you talk about pointing to common places of 1.5.
Reply | Threaded
Open this post in threaded view
|

Re: Java 3D in eclipse Mac OSX not functioning

gouessej
Administrator
CMBR wrote
All .Jars are "only" in the same directory as my Main.class and I run the java commands as so

craigs-mbp:bin Craig$ java -cp gluegen-rt.jar:j3dcore.jar:j3dutils.jar:joal.jar:jogl-all.jar:vecmath.jar: Main -Djava.ext.dirs="" Main
JavaVM WARNING: JAWT_GetAWT must be called after loading a JVM
AWT not found
(-11, 2, -5)
Exception in thread "main" java.lang.NoClassDefFoundError: apple/awt/CGraphicsDevice
        at javax.media.j3d.GraphicsConfigTemplate3D.<clinit>(GraphicsConfigTemplate3D.java:55)
        at com.sun.j3d.utils.universe.SimpleUniverse.getPreferredConfiguration(SimpleUniverse.java:368)
        at com.sun.j3d.utils.universe.Viewer.<init>(Viewer.java:348)
        at com.sun.j3d.utils.universe.Viewer.<init>(Viewer.java:298)
        at com.sun.j3d.utils.universe.SimpleUniverse.<init>(SimpleUniverse.java:215)
        at com.sun.j3d.utils.universe.SimpleUniverse.<init>(SimpleUniverse.java:177)
        at com.sun.j3d.utils.universe.SimpleUniverse.<init>(SimpleUniverse.java:88)
        at Main.main(Main.java:170)
Caused by: java.lang.ClassNotFoundException: apple.awt.CGraphicsDevice
        at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
        ... 8 more

Really not seeing what i'm missing from your tutorial,
Please type "java -version" and tell me what it prints.

CMBR wrote
I appreciate your telling me that it simply won't run with Java3D 1.5 but I have only been using the jars from your tutorial and can't find any other jars which could be 1.5 anywhere, I also can't see the directories you talk about pointing to common places of 1.5.
Those directories are mentioned in bold at the end of the "Download" subsection, refresh the page by pressing F5 or CTRL + R.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Java 3D in eclipse Mac OSX not functioning

gouessej
Administrator
In reply to this post by CMBR
What happens when you use this?
java -Djava.ext.dirs="" -cp gluegen-rt.jar:j3dcore.jar:j3dutils.jar:joal.jar:jogl-all.jar:vecmath.jar:. Main
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Java 3D in eclipse Mac OSX not functioning

CMBR
This,

craigs-mbp:bin Craig$ java -Djava.ext.dirs="" -cp gluegen-rt.jar:j3dcore.jar:j3dutils.jar:joal.jar:jogl-all.jar:vecmath.jar:. Main
3D [dev] 1.6.0-pre1-1011070059-experimental 07 Nov 2010 00:59:02 PDT

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:190)
        at javax.media.j3d.Pipeline$1.run(Pipeline.java:162)
        at java.security.AccessController.doPrivileged(Native Method)
        at javax.media.j3d.Pipeline.createPipeline(Pipeline.java:157)
        at javax.media.j3d.MasterControl.loadLibraries(MasterControl.java:954)
        at javax.media.j3d.VirtualUniverse.<clinit>(VirtualUniverse.java:299)
        at javax.media.j3d.GroupRetained.<init>(GroupRetained.java:161)
        at javax.media.j3d.BranchGroupRetained.<init>(BranchGroupRetained.java:55)
        at javax.media.j3d.BranchGroup.createRetained(BranchGroup.java:76)
        at javax.media.j3d.SceneGraphObject.<init>(SceneGraphObject.java:119)
        at javax.media.j3d.Node.<init>(Node.java:178)
        at javax.media.j3d.Group.<init>(Group.java:556)
        at javax.media.j3d.BranchGroup.<init>(BranchGroup.java:68)
        at Main.main(Main.java:68)
Caused by: java.lang.ClassNotFoundException: javax.media.opengl.AbstractGraphicsDevice
        at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
        ... 15 more


PS. I did find a couple of j3D jars in one of those directories so my bad, but yeh... deleted and still getting an error, no more apple awt though.

EDIT: Would it be possible for me to share my class files somewhere and you try compiling it on your macOS? If it doesn't work for you then that might rule out things? The program works 100% on windows 7.
Reply | Threaded
Open this post in threaded view
|

Re: Java 3D in eclipse Mac OSX not functioning

hharrison
Where did you download that version of Java3d?  I don't recall releasing a -pre1 on jogamp.

Harvey

Reply | Threaded
Open this post in threaded view
|

Re: Java 3D in eclipse Mac OSX not functioning

gouessej
Administrator
It's written pre11 in my article. He used the wrong version of Java 3D whereas he claimed to follow my tutorial

Please post your compile errors.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Java 3D in eclipse Mac OSX not functioning

CMBR
In reply to this post by hharrison
AHHHH ok it works now, thanks guys!

PS. I used the ones from your tutorial originally but I got frustrated and tried different ones, then forgot I changed them..
Reply | Threaded
Open this post in threaded view
|

Re: Java 3D in eclipse Mac OSX not functioning

gouessej
Administrator
You wrote "I do everything that is mentioned there", you just forgot to mention that you didn't strictly follow most of my indications, concerning the classpath, the command line options, the locations of the JARs, ...

You're welcome. Please strictly follow the instructions and keep your environment clean to avoid such problems next time. I have never told you to install an outdated version but anyway, it was the occasion of improving my tutorial. Thank you.
Julien Gouesse | Personal blog | Website
1234