Exception in thread “main” java.lang.NoClassDefFoundError: org/j3d/aviatrix3d/DrawableSurface

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

Exception in thread “main” java.lang.NoClassDefFoundError: org/j3d/aviatrix3d/DrawableSurface

smitthy
I have an error when I'm programming in Java. The error is:

Exception in thread "main" java.lang.NoClassDefFoundError: org/j3d/aviatrix3d/DrawableSurface
    at org.web3d.ogl.browser.X3DOGLBrowserFactoryImpl.createComponent(X3DOGLBrowserFactoryImpl.java:249)
    at org.web3d.x3d.sai.BrowserFactory.createX3DComponent(BrowserFactory.java:185)
    at xj3dtest.Xj3DTest.<init>(Xj3DTest.java:40)
    at xj3dtest.Xj3DTest.main(Xj3DTest.java:54)
Caused by: java.lang.ClassNotFoundException: org.j3d.aviatrix3d.DrawableSurface
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 4 more
C:\Users\matt\AppData\Local\NetBeans\Cache\8.1\executor-snippets\run.xml:53: Java returned: 1
BUILD FAILED (total time: 2 seconds)

And my Java code is

package xj3dtest;

import java.awt.BorderLayout;
import java.awt.Container;
import static java.lang.Boolean.TRUE;
import javax.swing.JFrame;
import org.web3d.x3d.sai.*;
import java.util.HashMap;

public class Xj3DTest extends JFrame {

    public Xj3DTest(String title) {

        super(title);

        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

        // Setup browser parameters
        HashMap requestedParameters=new HashMap();
        requestedParameters.put("Antialiased",TRUE);
        requestedParameters.put("TextureQuality","medium");
        requestedParameters.put("PrimitiveQuality","medium");
        requestedParameters.put("Xj3D_InterfaceType","SWING");
        requestedParameters.put("Xj3D_NavbarShown",TRUE);
        requestedParameters.put("Xj3D_NavbarPosition","TOP");
        requestedParameters.put("Xj3D_LocationShown",TRUE);
        requestedParameters.put("Xj3D_LocationPosition","TOP");
        requestedParameters.put("Xj3D_LocationReadOnly",TRUE);
        requestedParameters.put("Xj3D_ShowConsole",TRUE);
        requestedParameters.put("Xj3D_OpenButtonShown",TRUE);
        requestedParameters.put("Xj3D_ReloadButtonShown",TRUE);
        requestedParameters.put("Xj3D_StatusBarShown",TRUE);
        requestedParameters.put("Xj3D_FPSShown",TRUE);
        requestedParameters.put("Xj3D_ContentDirectory","CurrentDirectory");
        requestedParameters.put("Xj3D_AntialiasingQuality","low");
        requestedParameters.put("Xj3D_Culling_Mode", "frustum");

        System.setProperty("x3d.sai.factory.class", "org.xj3d.ui.awt.browser.ogl.X3DOGLBrowserFactoryImpl");
        BrowserFactory.setBrowserFactoryImpl(new org.web3d.ogl.browser.X3DOGLBrowserFactoryImpl());
        X3DComponent x3dComponent = BrowserFactory.createX3DComponent(requestedParameters);

        Browser browser = x3dComponent.getBrowser();

        Container cp = getContentPane();
        cp.setLayout(new BorderLayout());
        cp.add((javax.swing.JPanel)x3dComponent, BorderLayout.CENTER);

        X3DScene scene = browser.createX3DFromURL(new String[] {"test.x3d"});

        browser.replaceWorld(scene);
    }

    public static void main(String[] args) {
        Xj3DTest frame = new Xj3DTest("Xj3D test");
        frame.setSize(640, 480);
        frame.setLocationRelativeTo(null);
        frame.setVisible(true);
    }
}

And the jars that I'm using are

aviatrix3d-all_3.1.0-nps.jar
commons-compress-1.10.jar
dis-enums.jar  
geoapi-nogenerics-2.1.0.jar
gluegen-rt-natives-linux-amd64.jar  
gluegen-rt-natives-macosx-universal.jar
gluegen-rt-natives-windows-amd64.jar
gluegen-rt-natives-windows-i586.jar
gluegen-rt.jar  
gnu-regexp-1.0.8.jar
gt2-main-2.4.4.jar  
gt2-metadata-2.4.4.jar
gt2-referencing-2.4.4.jar
hibernate-jpa-2.0-api-1.0.0.Final.jar
httpclient.jar  
imageloader_1.1.0.jar
j3d-org-all_3.0.0-nps.jar  
jai_codec.jar
jai_core.jar
jgeom-core.jar
jhall.jar  
jmf.jar
joal-natives-linux-amd64.jar
joal-natives-macosx-universal.jar
joal-natives-windows-amd64.jar
joal-natives-windows-i586.jar
joal.jar
jogl-all-natives-linux-amd64.jar
jogl-all-natives-macosx-universal.jar  
jogl-all-natives-windows-amd64.jar  
jogl-all-natives-windows-i586.jar  
jogl-all.jar    
js.jar  
jsr108-0.01.jar
odejava-jni.jar
odejava.jar
open-dis_4.08.jar  
openmali.jar    
smack.jar  
smackx.jar  
toxiclibscore.jar  
uri.jar
vecmath.jar
vlc_uri.jar
xj3d-sai.jar
xj3d-ogl.jar
xj3d-script-base.jar
xj3d-core.jar

I have Google Chrome as my default browser. The VM Options that I have is -Xmx450M -Djava.library.path="C:\Users\matt\Documents\NetBeansProjects\jar1" which is where I have all the Jars saved. I've added the library that contains all the Jars to the Libraries section of the Project properties.
Reply | Threaded
Open this post in threaded view
|

Re: Exception in thread “main” java.lang.NoClassDefFoundError: org/j3d/aviatrix3d/DrawableSurface

philjord
smitthy,
It looks like you are using Aviatrix3D (http://aviatrix3d.j3d.org/).

Although they use the package name j3d there is no overlap with Java3D (which is a similar but totally separate scene graph).

So your question won't be properly answered in this forum.

I notice in this discussion with Luke Woodward:
http://stackoverflow.com/questions/35638321/java-lang-illegalaccesserror-when-running-code

He asked you to use:
xj3d-2.1-3rdparty-nps.jar
xj3d-2.1-nps.jar
from https://sourceforge.net/projects/xj3d/files/installers/

I see that the source forge download is some sort of crazy installer, however you can get the 2 jars he mentions from here:
https://savage.nps.edu/Xj3D.nps/jars/

Then you'll have to follow Luke's instructions on making it work with Xj3D 2.

Good luck...

Reply | Threaded
Open this post in threaded view
|

Re: Exception in thread “main” java.lang.NoClassDefFoundError: org/j3d/aviatrix3d/DrawableSurface

smitthy
philjord Thanks for the help,

But now I've made some changes and I have got the following jars that I'm using
gluegen-rt
gluegen-rt-natives-linux-amd64
gluegen-rt-natives-windows-amd64
gluegen-rt-natives-windows-i586
j3d-core-1.3.1
jhall
joal
joal-natives-linux-amd64
joal-natives-windows-amd64
joal-natives-windows-i586
jogl-all
jogl-all-natives-linux-amd64
jogl-all-natives-windows-amd64
jogl-all-natives-windows-i586
xj3d.browser_2.1.0-nps
xj3d.cadfilter_2.1.0-nps
xj3d.replica_2.1.0-nps
xj3d-2.1-3rdparty-nps
xj3d-2.1-nps
xj3d-core
xj3d-j3d
xj3d-ogl
xj3d-runtime
xj3d-script-base

And I'm getting the error

run:
C:\Users\matt\AppData\Local\NetBeans\Cache\8.1\executor-snippets\run.xml:48: Problem: failed to create task or type translate-classpath
Cause: The name is undefined.
Action: Check the spelling.
Action: Check that any custom tasks/types have been declared.
Action: Check that any <presetdef>/<macrodef> declarations have taken place.
BUILD FAILED (total time: 0 seconds)

And I'm still using the same Java code and within the run.xml file, I have

<?xml version="1.0" encoding="UTF-8"?>
<project name="{0} (run)" default="run" basedir=".">
    <target name="run">       
        <translate-classpath classpath="${classpath}" targetProperty="classpath-translated" />
        <property name="run.jvmargs" value="" />
        <property name="work.dir" value="${basedir}"/>
        <property name="application.args" value="" />
        <property name="java.failonerror" value="true"/>
        <java classpath="${classpath-translated}" classname="${classname}" dir="${work.dir}" jvm="${platform.java}" fork="true" failonerror="${java.failonerror}">
            <jvmarg value="-Dfile.encoding=${encoding}"/>
            <redirector inputencoding="${encoding}" outputencoding="${encoding}" errorencoding="${encoding}"/>
            <jvmarg line="${run.jvmargs}" />
            <arg line="${application.args}" />
            <syspropertyset>
                <propertyref prefix="run-sys-prop."/>
                <mapper from="run-sys-prop.*" to="*" type="glob"/>
            </syspropertyset>
        </java>
    </target>
</project>

The error points to the line
<translate-classpath classpath="${classpath}" targetProperty="classpath-translated" />
Reply | Threaded
Open this post in threaded view
|

Re: Exception in thread “main” java.lang.NoClassDefFoundError: org/j3d/aviatrix3d/DrawableSurface

jmaasing
That's en error in the Netbeans generated files and has nothing to do with Java3D. Maybe recreate your project in netbeans will fix it.
Reply | Threaded
Open this post in threaded view
|

Re: Exception in thread “main” java.lang.NoClassDefFoundError: org/j3d/aviatrix3d/DrawableSurface

smitthy
I have re-created the project a few times and it always gives me the same error
Reply | Threaded
Open this post in threaded view
|

Re: Exception in thread “main” java.lang.NoClassDefFoundError: org/j3d/aviatrix3d/DrawableSurface

gouessej
Administrator
In reply to this post by smitthy
Hi

Actually, you're using Aviatrix, this section is about Java3D. The missing class comes from Aviatrix.

By the way, you can use jogamp-fat.jar to simplify your deployment.

Moreover, I'm not sure that Aviatrix supports JOGL 2.
Julien Gouesse | Personal blog | Website