netbeans - Getting a running error while running some code to import X3D into Java -
i'm trying make project loads x3d files java , java display them, i'm using xj3d when run code, seem getting error. i've downloaded jars listed here. i've made library that's called 'xj3d' , in project properties, in libraries section, i've put xj3d library , in vm options, i've put -xmx450m -djava.library.path='c:\users\matt\downloads\xj3d-sai_2.0.0.jar'
, code have in java is:
package xj3dtest; import java.awt.borderlayout; import java.awt.component; import java.awt.container; import static java.lang.boolean.true; import javax.swing.jframe; import org.web3d.x3d.sai.browser; import org.web3d.x3d.sai.browserfactory; import org.web3d.x3d.sai.x3dcomponent; import org.web3d.x3d.sai.x3dscene; 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.web3d.ogl.browser.x3doglbrowserfactoryimpl"); x3dcomponent x3dcomponent = browserfactory.createx3dcomponent(requestedparameters); browser browser = x3dcomponent.getbrowser(); component browsercomponent = (component) x3dcomponent.getimplementation(); container cp = getcontentpane(); cp.setlayout(new borderlayout()); cp.add(browsercomponent, borderlayout.center); x3dscene scene = browser.createx3dfromurl(new string[] {"test.x3dv"}); 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 i've put test.x3dv file in project folder. test.x3dv code follows:
#x3d v3.0 utf8 profile interactive def ts timesensor { cycleinterval 3 loop true } def tg transform { rotation 0 1 0 0 children shape { geometry box {} appearance appearance { material def mat material { diffusecolor 1 0 0 } } } } def oi orientationinterpolator { key [ 0 0.5 1 ] keyvalue [ 0 1 0 0 0 1 0 3.14 0 1 0 6.28 ] } route ts.fraction_changed oi.set_fraction route oi.value_changed tg.rotation
when press run button in netbeans, following runtime error:
no skin defined in xj3d-skin.properties producing default properties. exception in thread "main" java.lang.noclassdeffounderror: org/j3d/aviatrix3d/drawablesurface @ org.web3d.ogl.browser.x3doglbrowserfactoryimpl.createcomponent(x3doglbrowserfactoryimpl.java:249) @ org.web3d.x3d.sai.browserfactory.createx3dcomponent(browserfactory.java:252) @ xj3dtest.xj3dtest.<init>(xj3dtest.java:43) @ xj3dtest.xj3dtest.main(xj3dtest.java:59) caused by: java.lang.classnotfoundexception: org.j3d.aviatrix3d.drawablesurface @ java.net.urlclassloader$1.run(urlclassloader.java:366) @ java.net.urlclassloader$1.run(urlclassloader.java:355) @ java.security.accesscontroller.doprivileged(native method) @ java.net.urlclassloader.findclass(urlclassloader.java:354) @ java.lang.classloader.loadclass(classloader.java:425) @ sun.misc.launcher$appclassloader.loadclass(launcher.java:308) @ java.lang.classloader.loadclass(classloader.java:358) ... 4 more
Comments
Post a Comment