HelloJava3D Run-Error

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

HelloJava3D Run-Error

therealcalle
Hi Everyone!
this is my first code with j3d..

import java.applet.*;
import java.awt.*;
import java.awt.GraphicsConfiguration;
import javax.media.j3d.BranchGroup;
import javax.media.j3d.Canvas3D;
import javax.media.j3d.Transform3D;
import javax.media.j3d.TransformGroup;

import com.sun.j3d.utils.applet.MainFrame;
import com.sun.j3d.utils.geometry.ColorCube;
import com.sun.j3d.utils.universe.SimpleUniverse;



public class HelloJava3D extends Applet {

        public HelloJava3D() {
                setLayout(new BorderLayout());
                Transform3D t = new Transform3D();
                GraphicsConfiguration config = SimpleUniverse.getPreferredConfiguration();
                Canvas3D canvas3D = new Canvas3D(config);
                add("Center",canvas3D);
                BranchGroup scene = createSceneGraph();
                scene.compile();
               
                SimpleUniverse simpleU = new SimpleUniverse(canvas3D);
                simpleU.getViewingPlatform().setNominalViewingTransform();
                simpleU.addBranchGraph(scene);
        }
       
        public BranchGroup createSceneGraph() {
                BranchGroup node = new BranchGroup();
                TransformGroup TG = createSubGraph();
                node.addChild(TG);
                return node;
        }
       
        public TransformGroup createSubGraph() {
                TransformGroup transform = new TransformGroup();
                transform.addChild(new ColorCube(0.3));
                return transform;
        }
       
        public static void main(String args[]) {
                new MainFrame(new HelloJava3D(), 1024, 768);
        }
}


Computer : MacBook 2019 - macOS 10.15.1 - Catalina
Im using : Eclipse IDE for Java Developers 4.13.0

I'm using jdk8

-------------------------------------------------------------------------------
Error when I run project:

Exception in thread "J3D-Renderer-1" java.lang.NoClassDefFoundError: com/sun/gluegen/runtime/DynamicLookupHelper
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:756)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:468)
        at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:756)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:468)
        at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:264)
        at javax.media.opengl.GLDrawableFactory.getFactory(GLDrawableFactory.java:108)
        at javax.media.j3d.JoglPipeline$QueryCanvas.<init>(JoglPipeline.java:9010)
        at javax.media.j3d.JoglPipeline.getBestConfiguration(JoglPipeline.java:8774)
        at javax.media.j3d.Renderer.doWork(Renderer.java:495)
        at javax.media.j3d.J3dThread.run(J3dThread.java:256)
Caused by: java.lang.ClassNotFoundException: com.sun.gluegen.runtime.DynamicLookupHelper
        at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
        ... 29 more
-----------------------------------------------------------------------------------

when I run project I have this error and the applet doesn't start.. please help me I don't know what I'm wrong
Reply | Threaded
Open this post in threaded view
|

Re: HelloJava3D Run-Error

gouessej
Administrator
Hello

You put all JARs into the JRE which is a bad practice. I think that some JARs are missing too. You use a JAR coming from JOGL 1 whereas Java3D >= 1.6 requires JOGL 2 (and Gluegen).

Please follow the instructions of my guide:
https://gouessej.wordpress.com/2012/08/01/java-3d-est-de-retour-java-3d-is-back/#eclipse

Please don't use applets, they are dead and obsolete.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: HelloJava3D Run-Error

therealcalle
I've tried with you example using PyramidExample but I had a crash and this error:





Process:               java [1686]
Path:                  /Library/Java/JavaVirtualMachines/jdk-13.0.1.jdk/Contents/Home/bin/java
Identifier:            net.java.openjdk.cmd
Version:               1.0 (1.0)
Code Type:             X86-64 (Native)
Parent Process:        eclipse [1124]
Responsible:           eclipse [1124]
User ID:               501

Date/Time:             2019-11-14 14:38:47.819 +0100
OS Version:            Mac OS X 10.15.1 (19B88)
Report Version:        12
Bridge OS Version:     4.1 (17P1081)
Anonymous UUID:        3E7C03B3-C12E-788C-373C-E2DB7623BAEC

Sleep/Wake UUID:       53838450-A037-4342-BC2F-C8835C94E15E

Time Awake Since Boot: 11000 seconds
Time Since Wake:       2000 seconds

System Integrity Protection: enabled

Crashed Thread:        2

Exception Type:        EXC_BAD_ACCESS (SIGABRT)
Exception Codes:       KERN_PROTECTION_FAILURE at 0x00000001043d5008
Exception Note:        EXC_CORPSE_NOTIFY

VM Regions Near 0x1043d5008:
    shared memory          00000001043d4000-00000001043d5000 [    4K] r--/r-- SM=SHM  
--> VM_ALLOCATE            00000001043d5000-00000001043d6000 [    4K] ---/rwx SM=NUL  
    VM_ALLOCATE            00000001043d6000-00000001043d7000 [    4K] r--/rwx SM=PRV  

Application Specific Information:
abort() called
terminating with uncaught exception of type NSException
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'NSWindow drag regions should only be invalidated on the Main Thread!'






Also Eclipse return:

WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by javax.media.j3d.JoglPipeline (file:/Users/albicallegari/eclipse-workspace/piram/src/j3d/j3dcore.jar) to method sun.awt.AppContext.getAppContext()
WARNING: Please consider reporting this to the maintainers of javax.media.j3d.JoglPipeline
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
2019-11-14 14:38:47.816 java[1686:93417] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'NSWindow drag regions should only be invalidated on the Main Thread!'
*** First throw call stack:
(
        0   CoreFoundation                      0x00007fff33d0bf53 __exceptionPreprocess + 250
        1   libobjc.A.dylib                     0x00007fff69dd1835 objc_exception_throw + 48
        2   CoreFoundation                      0x00007fff33d2652c -[NSException raise] + 9
        3   AppKit                              0x00007fff30eda6b2 -[NSWindow(NSWindow_Theme) _postWindowNeedsToResetDragMarginsUnlessPostingDisabled] + 310
        4   AppKit                              0x00007fff30ed7bc1 -[NSWindow _initContent:styleMask:backing:defer:contentView:] + 1416
        5   AppKit                              0x00007fff30ed7633 -[NSWindow initWithContentRect:styleMask:backing:defer:] + 42
        6   libnativewindow_macosx.jnilib       0x000000010c5c43fe Java_jogamp_nativewindow_macosx_OSXUtil_CreateNSWindow0 + 398
        7   ???                                 0x0000000115352c90 0x0 + 4650773648
)
libc++abi.dylib: terminating with uncaught exception of type NSException



Reply | Threaded
Open this post in threaded view
|

Re: HelloJava3D Run-Error

gouessej
Administrator
You're affected by a bug in JOGL 2.3.2, it's fixed in the next release. Sorry for the bad news.
Julien Gouesse | Personal blog | Website