I'm making a Xj3D test file in java and I have a file that works with one X3D and X3DV file called test.x3d
and test.x3dv
which is the same file just in two different formats and it's a red square. However, when I try and put my own X3D files in, I get the following runtime error
run:
Mar 20, 2016 12:11:30 PM java.util.prefs.WindowsPreferences <init>
WARNING: Could not open/create prefs root node Software\JavaSoft\Prefs at root 0x80000002. Windows RegCreateKeyEx(...) returned error code 5.
Message: WARNING: antialiasing will be disabled because the DefaultGLCapabilitiesChooser didn't supply it
Mar 20, 2016 12:11:32 PM org.odejava.Odejava <clinit>
SEVERE: Native code library (32 and 64 bit library) failed to load: java.lang.UnsatisfiedLinkError: no odejava in java.library.path
java.lang.UnsatisfiedLinkError: no odejava in java.library.path
Warning: The class that you specificed for the physics manager is not a valid instance of PhysicsManager
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1864)
at java.lang.Runtime.loadLibrary0(Runtime.java:870)
at java.lang.System.loadLibrary(System.java:1122)
at org.odejava.Odejava.<clinit>(Odejava.java:103)
at org.xj3d.impl.core.eventmodel.DefaultRigidBodyPhysicsManager$1.run(DefaultRigidBodyPhysicsManager.java:149)
at org.xj3d.impl.core.eventmodel.DefaultRigidBodyPhysicsManager$1.run(DefaultRigidBodyPhysicsManager.java:142)
at java.security.AccessController.doPrivileged(Native Method)
at org.xj3d.impl.core.eventmodel.DefaultRigidBodyPhysicsManager.<clinit>(DefaultRigidBodyPhysicsManager.java:141)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at org.web3d.vrml.renderer.ogl.browser.OGLBrowserCanvas$4.run(OGLBrowserCanvas.java:1069)
at java.security.AccessController.doPrivileged(Native Method)
at org.web3d.vrml.renderer.ogl.browser.OGLBrowserCanvas.loadClass(OGLBrowserCanvas.java:1064)
at org.web3d.vrml.renderer.ogl.browser.OGLBrowserCanvas.initialize(OGLBrowserCanvas.java:694)
at org.xj3d.ui.awt.browser.ogl.BrowserJPanel.<init>(BrowserJPanel.java:256)
at org.xj3d.ui.awt.browser.ogl.X3DBrowserJPanel.<init>(X3DBrowserJPanel.java:75)
at org.xj3d.ui.awt.browser.ogl.X3DOGLBrowserFactoryImpl.createComponent(X3DOGLBrowserFactoryImpl.java:219)
at org.web3d.x3d.sai.BrowserFactory.createX3DComponent(BrowserFactory.java:263)
at xj3dtest.Xj3DTest.<init>(Xj3DTest.java:42)
at xj3dtest.Xj3DTest.main(Xj3DTest.java:56)
Message: Device found: Mouse-0
Message: Device found: Keyboard-0
Exception in thread "main" org.web3d.vrml.lang.UnsupportedNodeException: Request for a node that is not part of the specified profile and components for this stream: viewpoint
at org.web3d.vrml.renderer.DefaultNodeFactory.createVRMLNode(DefaultNodeFactory.java:730)
at org.web3d.vrml.renderer.ogl.OGLMainSceneBuilder.startNode(OGLMainSceneBuilder.java:147)
at org.web3d.vrml.renderer.ogl.OGLVRMLSceneBuilder.startNode(OGLVRMLSceneBuilder.java:514)
at org.web3d.x3d.jaxp.X3DSAVAdapter.startElement(X3DSAVAdapter.java:830)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:509)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:1364)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2787)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:606)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:848)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:777)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:643)
at org.web3d.parser.GeneralisedReader.parse(GeneralisedReader.java:261)
at org.xj3d.impl.core.loading.DefaultWorldLoader.loadNow(DefaultWorldLoader.java:156)
at org.xj3d.impl.core.loading.DefaultWorldLoader.loadNow(DefaultWorldLoader.java:203)
at org.web3d.vrml.scripting.browser.X3DCommonBrowser.createX3DFromURL(X3DCommonBrowser.java:264)
at org.web3d.vrml.scripting.external.sai.SAIBrowser.createX3DFromURL(SAIBrowser.java:843)
at xj3dtest.Xj3DTest.<init>(Xj3DTest.java:50)
at xj3dtest.Xj3DTest.main(Xj3DTest.java:56)
And my java class is as follows
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.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.xj3d.ui.awt.browser.ogl.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[] {"hafodty_circle1.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);
}
}
I'm using Netbeans to program this and I have got the hafodty_circle1.x3d
and hafodty_circle1.x3dv
save in the Xj3DTest project. I know I get a runtime error when I run the code with test.x3d
and test.x3dv
but I get an output with those files and I don't get any output when I run the code when I have other x3d
files in. Any help with this error would mean a lot, thanks.
EDIT 01/04/2016
In the Project Properties and in the Run menu, and in the VM Options. I have the following:
java -Djava.library.path="C:\Users\matt\Documents\NetBeansProjects\natives\Windows_10\amd64"
java -Djava.library.path="C:\Users\matt\Documents\NetBeansProjects\natives\Windows_10\x86_64"
as I didn't know which odejava64.dll
I should use. Now when I run my project, I get the following error:
Error: Could not find or load main class java
C:\Users\matt\AppData\Local\NetBeans\Cache\8.1\executor-snippets\run.xml:53: Java returned: 1
BUILD FAILED (total time: 0 seconds)
And within executor-snippets
is:
<?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>
This error UnsatisfiedLinkError
means that you are missing a native library (odejava.dll
if you're running on Windows), or that you're using 32-bit Java with a 64-bit native library or vice versa.
Make sure the system property java.library.path
is set to the directory that contains the native library and make sure that the "bitness" of your Java runtime environment is the same as the native library (both 32-bit or both 64-bit).
You set the java.library.path
property with the -D
command line option when you run your program. For example, if odejava.dll
is in directory C:\MyProject\lib
:
java -Djava.library.path=C:\MyProject\lib com.myproject.MyMainClass
User contributions licensed under CC BY-SA 3.0