Getting Java3D to work in Eclipse - java

I am trying to get J3D to work in Eclipse and have read forum after forum but can't seem to fix my problem. I am using ubuntu 11.10
I have done this:
0) unzipped j3d-1_5_2-linux-i586 in home/j3d directory then added i386 folder to usr/lib/jvm/java-6-openjdkjre/lib/i386
1) Window--> Preferences--> User Libraries --> New and added the three .jar files (j3dcore.jar, j3dutils.jar, vecmath.core)
2) Added a native library location to point to usr/lib/jvm/java-6-openjdkjre/lib/i386 where the .so files are
Some sources say try adding the .jar files to your Classpath Variable which didn't fix the problem for me.
I keep getting
Exception in thread "main" java.lang.UnsatisfiedLinkError: /usr/lib/jvm/java-6-openjdk/jre/lib/amd64/libj3dcore-ogl.so: /usr/lib/jvm/java-6-openjdk/jre/lib/amd64/libj3dcore-ogl.so: wrong ELF class: ELFCLASS32 (Possible cause: architecture word width mismatch)
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1750)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1667)
at java.lang.Runtime.loadLibrary0(Runtime.java:840)
at java.lang.System.loadLibrary(System.java:1047)
at javax.media.j3d.NativePipeline$1.run(NativePipeline.java:231)
at java.security.AccessController.doPrivileged(Native Method)
at javax.media.j3d.NativePipeline.loadLibrary(NativePipeline.java:200)
at javax.media.j3d.NativePipeline.loadLibraries(NativePipeline.java:157)
at javax.media.j3d.MasterControl.loadLibraries(MasterControl.java:987)
at javax.media.j3d.VirtualUniverse.(VirtualUniverse.java:299)
at Hello3d.(Hello3d.java:13)
at Hello3d.main(Hello3d.java:27)

I had the same problems. Most tutorials tell you to assign an new library, but i mixed the Java3D files with the JDK files and re installed eclipse. If this doesn't work use net Beans.

Related

Configure OpenCV to use in java does not work

Currently I try to use OpenCV in my Java application. In maven I used the newest library
<groupId>org.openpnp</groupId>
<artifactId>opencv</artifactId>
<version>4.5.1-2</version>
and I installed OpenCV with
brew install opencv
I also found the installation in
/usr/local/Cellar/opencv/4.5.3/
but when I try to run my java application with
System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
i got
Exception in thread "Thread-0" java.lang.UnsatisfiedLinkError: no opencv_java453 in java.library.path: [/Users/me/Library/Java/Extensions, /Library/Java/Extensions, /Network/Library/Java/Extensions, /System/Library/Java/Extensions, /usr/lib/java, .]
at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2660)
at java.base/java.lang.Runtime.loadLibrary0(Runtime.java:827)
at java.base/java.lang.System.loadLibrary(System.java:1871)
...
I use IntelliJ and in my run configuration I also added as program argument
-Djava.library.path=/usr/local/Cellar/opencv/4.5.3/lib
but when I read out in this program the java.library.path I got:
properties: /Users/me/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:.
so I miss the added path...
I also do not found any symbol called opencv_java451 or opencv_java453
can anyone help me? Tanks a lot!
You can find your machine's java.library.path directory.
In my MacBook, it was /Library/Java/Extensions.
Copy the dylib file into it.

Can't find the dependent library for mavenized JCUDA in Eclipse

I am trying to setup mavenized JCUDA for a project that I am working on and am running into issues with telling java where to locate the library files.
Setting up and getting maven to build the .jar and .dll files has worked fine, I can see the correctly named .dll files in project\target\lib and I am setting my native library location to this folder.
The error I get when trying to run one of the programs from JCUDA JCublasSample.java (www.jcuda.org/samples/JCublasSample.java) is:
Creating input data... Performing Sgemm with Java... Performing Sgemm
with JCublas...
Exception in thread "main" java.lang.UnsatisfiedLinkError: Could not
load the native library.
Error while loading native library "JCublas-windows-x86_64" with base
name "JCublas" Operating system name: Windows 7 Architecture :
amd64 Architecture bit size: 64
Stack trace from the attempt to load the library as a resource:
java.lang.NullPointerException: No resource found with name
'/lib/JCublas-windows-x86_64.dll'
at jcuda.LibUtils.loadLibraryResource(LibUtils.java:149) at
jcuda.LibUtils.loadLibrary(LibUtils.java:83) at
jcuda.jcublas.JCublas.initialize(JCublas.java:93) at
jcuda.jcublas.JCublas.(JCublas.java:81) at
JCublasSample.sgemmJCublas(JCublasSample.java:64) at
JCublasSample.testSgemm(JCublasSample.java:49) at
JCublasSample.main(JCublasSample.java:25)
Stack trace from the attempt to load the library as a file:
java.lang.UnsatisfiedLinkError:
C:\Users\kristoffer.bernhem\git\SMlocalizer\target\lib\JCublas-windows-x86_64.dll:
Can't find dependent libraries
at java.lang.ClassLoader$NativeLibrary.load(Native Method) at
java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1941) at
java.lang.ClassLoader.loadLibrary(ClassLoader.java:1857) at
java.lang.Runtime.loadLibrary0(Runtime.java:870) at
java.lang.System.loadLibrary(System.java:1122) at
jcuda.LibUtils.loadLibrary(LibUtils.java:94) at
jcuda.jcublas.JCublas.initialize(JCublas.java:93) at
jcuda.jcublas.JCublas.(JCublas.java:81) at
JCublasSample.sgemmJCublas(JCublasSample.java:64) at
JCublasSample.testSgemm(JCublasSample.java:49) at
JCublasSample.main(JCublasSample.java:25) at
jcuda.LibUtils.loadLibrary(LibUtils.java:128) at
jcuda.jcublas.JCublas.initialize(JCublas.java:93) at
jcuda.jcublas.JCublas.(JCublas.java:81) at
JCublasSample.sgemmJCublas(JCublasSample.java:64) at
JCublasSample.testSgemm(JCublasSample.java:49) at
JCublasSample.main(JCublasSample.java:25)
As explained by Guenther, the problem lies in supporting .dll files that are lacking. How would I go about sorting this error out?
This is being run in windows 7 (64bit) and run with JDK1.8.0_91.

Why am I missing /System/Library/Frameworks/JavaVM.framework/Libraries/libjawt.dylib on MacOSX?

I have been trying to install Java3D 1.5.2 on my Mac (OS 10.10). First I tried using the installer referenced in this answer by whiskeyspider. It installed the files, but I got an error when I tried to run a program. So I cleared out /Library/Java/Extensions and tried to install manually in ~/.local/lib, a directory I created previously, and just include the jars in my project's build path (Eclipse). Despite including the jars and native library locations (for the JOGL jars) I get the following error when I try to run the program:
Exception in thread "J3D-Renderer-1" java.lang.UnsatisfiedLinkError: /Users/brianmc7/.local/lib/jogl/lib/libjogl_awt.jnilib: dlopen(/Users/brianmc7/.local/lib/jogl/lib/libjogl_awt.jnilib, 1): Library not loaded: /System/Library/Frameworks/JavaVM.framework/Libraries/libjawt.dylib
Referenced from: /Users/brianmc7/.local/lib/jogl/lib/libjogl_awt.jnilib
Reason: image not found
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1929)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1851)
at java.lang.Runtime.loadLibrary0(Runtime.java:870)
at java.lang.System.loadLibrary(System.java:1119)
at com.sun.opengl.impl.NativeLibLoader.loadLibraryInternal(NativeLibLoader.java:189)
at com.sun.opengl.impl.NativeLibLoader.access$000(NativeLibLoader.java:49)
at com.sun.opengl.impl.NativeLibLoader$DefaultAction.loadLibrary(NativeLibLoader.java:80)
at com.sun.opengl.impl.NativeLibLoader.loadLibrary(NativeLibLoader.java:103)
at com.sun.opengl.impl.NativeLibLoader.access$200(NativeLibLoader.java:49)
at com.sun.opengl.impl.NativeLibLoader$2.run(NativeLibLoader.java:132)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.opengl.impl.NativeLibLoader.loadAWTImpl(NativeLibLoader.java:118)
at com.sun.opengl.impl.JAWT.getJAWT(JAWT.java:91)
at com.sun.opengl.impl.macosx.MacOSXOnscreenGLDrawable.lockSurface(MacOSXOnscreenGLDrawable.java:144)
at com.sun.opengl.impl.macosx.MacOSXOnscreenGLContext.makeCurrentImpl(MacOSXOnscreenGLContext.java:57)
at com.sun.opengl.impl.GLContextImpl.makeCurrent(GLContextImpl.java:134)
at javax.media.j3d.JoglPipeline$QueryCanvas.doQuery(JoglPipeline.java:9049)
at javax.media.j3d.JoglPipeline.getBestConfiguration(JoglPipeline.java:8797)
at javax.media.j3d.Renderer.doWork(Renderer.java:514)
at javax.media.j3d.J3dThread.run(J3dThread.java:275)
It turns out that the directory /System/Library/Frameworks/JavaVM.framework/Libraries/ doesn't exist. How can I fix this problem?
EDIT: I should probably also mention that I am using JDK 1.8.0_40 early access.
Java3D was abandoned by Sun Microsystems / Oracle in 2008. Java3D has been maintained by the JogAmp community since 2012. Yes, Java3D 1.6 is composed of several pre-releases but they work much better than Java3D 1.5.
My own tutorial explains in details how to install the very latest version of Java3D.

Error after build when running JOGL Tutorial

I'm trying to figure out how to program OpenGL in Java, but when I ran the tutorial here, with all the libraries loaded (I think) correctly, as it was able to import the libraries, it gave me this weird error:
"C:\Program Files\Java\jdk1.7.0_25\bin\java" -Didea.launcher.port=7532 "-Didea.launcher.bin.path=C:\Program Files (x86)\JetBrains\IntelliJ IDEA Community Edition 12.1.4\bin" -Dfile.encoding=UTF-8 -classpath "C:\Program Files\Java\jdk1.7.0_25\jre\lib\charsets.jar;C:\Program Files\Java\jdk1.7.0_25\jre\lib\deploy.jar;C:\Program Files\Java\jdk1.7.0_25\jre\lib\javaws.jar;C:\Program Files\Java\jdk1.7.0_25\jre\lib\jce.jar;C:\Program Files\Java\jdk1.7.0_25\jre\lib\jfr.jar;C:\Program Files\Java\jdk1.7.0_25\jre\lib\jfxrt.jar;C:\Program Files\Java\jdk1.7.0_25\jre\lib\jsse.jar;C:\Program Files\Java\jdk1.7.0_25\jre\lib\management-agent.jar;C:\Program Files\Java\jdk1.7.0_25\jre\lib\plugin.jar;C:\Program Files\Java\jdk1.7.0_25\jre\lib\resources.jar;C:\Program Files\Java\jdk1.7.0_25\jre\lib\rt.jar;C:\Program Files\Java\jdk1.7.0_25\jre\lib\ext\access-bridge-64.jar;C:\Program Files\Java\jdk1.7.0_25\jre\lib\ext\dnsns.jar;C:\Program Files\Java\jdk1.7.0_25\jre\lib\ext\jaccess.jar;C:\Program Files\Java\jdk1.7.0_25\jre\lib\ext\localedata.jar;C:\Program Files\Java\jdk1.7.0_25\jre\lib\ext\sunec.jar;C:\Program Files\Java\jdk1.7.0_25\jre\lib\ext\sunjce_provider.jar;C:\Program Files\Java\jdk1.7.0_25\jre\lib\ext\sunmscapi.jar;C:\Program Files\Java\jdk1.7.0_25\jre\lib\ext\zipfs.jar;C:\Code\Java\Games\Rust\out\production\Rust;C:\Code\Java\Libraries\jogamp-all-platforms\jar\joal.jar;C:\Code\Java\Libraries\jogamp-all-platforms\jar\jocl.jar;C:\Code\Java\Libraries\jogamp-all-platforms\jar\gluegen.jar;C:\Code\Java\Libraries\jogamp-all-platforms\jar\jogl-all.jar;C:\Code\Java\Libraries\jogamp-all-platforms\jar\joal-test.jar;C:\Code\Java\Libraries\jogamp-all-platforms\jar\jogl-test.jar;C:\Code\Java\Libraries\jogamp-all-platforms\jar\gluegen-rt.jar;C:\Code\Java\Libraries\jogamp-all-platforms\jar\joal-android.jar;C:\Code\Java\Libraries\jogamp-all-platforms\jar\jogl-all-noawt.jar;C:\Code\Java\Libraries\jogamp-all-platforms\jar\jogl-all-mobile.jar;C:\Code\Java\Libraries\jogamp-all-platforms\jar\jogl-all-android.jar;C:\Code\Java\Libraries\jogamp-all-platforms\jar\joal-test-android.jar;C:\Code\Java\Libraries\jogamp-all-platforms\jar\jogl-test-android.jar;C:\Code\Java\Libraries\jogamp-all-platforms\jar\gluegen-rt-android.jar;C:\Code\Java\Libraries\jogamp-all-platforms\jar\joal-natives-linux-i586.jar;C:\Code\Java\Libraries\jogamp-all-platforms\jar\jocl-natives-linux-i586.jar;C:\Code\Java\Libraries\jogamp-all-platforms\jar\joal-natives-linux-amd64.jar;C:\Code\Java\Libraries\jogamp-all-platforms\jar\joal-natives-linux-armv6.jar;C:\Code\Java\Libraries\jogamp-all-platforms\jar\jocl-natives-linux-amd64.jar;C:\Code\Java\Libraries\jogamp-all-platforms\jar\jocl-natives-linux-armv6.jar;C:\Code\Java\Libraries\jogamp-all-platforms\jar\joal-natives-solaris-i586.jar;C:\Code\Java\Libraries\jogamp-all-platforms\jar\joal-natives-windows-i586.jar;C:\Code\Java\Libraries\jogamp-all-platforms\jar\jocl-natives-solaris-i586.jar;C:\Code\Java\Libraries\jogamp-all-platforms\jar\jocl-natives-windows-i586.jar;C:\Code\Java\Libraries\jogamp-all-platforms\jar\joal-natives-android-armv6.jar;C:\Code\Java\Libraries\jogamp-all-platforms\jar\joal-natives-linux-armv6hf.jar;C:\Code\Java\Libraries\jogamp-all-platforms\jar\joal-natives-solaris-amd64.jar;C:\Code\Java\Libraries\jogamp-all-platforms\jar\joal-natives-windows-amd64.jar;C:\Code\Java\Libraries\jogamp-all-platforms\jar\jocl-natives-android-armv6.jar;C:\Code\Java\Libraries\jogamp-all-platforms\jar\jocl-natives-linux-armv6hf.jar;C:\Code\Java\Libraries\jogamp-all-platforms\jar\jocl-natives-solaris-amd64.jar;C:\Code\Java\Libraries\jogamp-all-platforms\jar\jocl-natives-windows-amd64.jar;C:\Code\Java\Libraries\jogamp-all-platforms\jar\jogl-all-natives-linux-i586.jar;C:\Code\Java\Libraries\jogamp-all-platforms\jar\jogl-all-natives-linux-amd64.jar;C:\Code\Java\Libraries\jogamp-all-platforms\jar\jogl-all-natives-linux-armv6.jar;C:\Code\Java\Libraries\jogamp-all-platforms\jar\gluegen-rt-natives-linux-i586.jar;C:\Code\Java\Libraries\jogamp-all-platforms\jar\joal-natives-macosx-universal.jar;C:\Code\Java\Libraries\jogamp-all-platforms\jar\jocl-natives-macosx-universal.jar;C:\Code\Java\Libraries\jogamp-all-platforms\jar\jogl-all-natives-solaris-i586.jar;C:\Code\Java\Libraries\jogamp-all-platforms\jar\jogl-all-natives-windows-i586.jar;C:\Code\Java\Libraries\jogamp-all-platforms\jar\gluegen-rt-natives-linux-amd64.jar;C:\Code\Java\Libraries\jogamp-all-platforms\jar\gluegen-rt-natives-linux-armv6.jar;C:\Code\Java\Libraries\jogamp-all-platforms\jar\jogl-all-natives-android-armv6.jar;C:\Code\Java\Libraries\jogamp-all-platforms\jar\jogl-all-natives-linux-armv6hf.jar;C:\Code\Java\Libraries\jogamp-all-platforms\jar\jogl-all-natives-solaris-amd64.jar;C:\Code\Java\Libraries\jogamp-all-platforms\jar\jogl-all-natives-windows-amd64.jar;C:\Code\Java\Libraries\jogamp-all-platforms\jar\gluegen-rt-natives-solaris-i586.jar;C:\Code\Java\Libraries\jogamp-all-platforms\jar\gluegen-rt-natives-windows-i586.jar;C:\Code\Java\Libraries\jogamp-all-platforms\jar\gluegen-rt-natives-android-armv6.jar;C:\Code\Java\Libraries\jogamp-all-platforms\jar\gluegen-rt-natives-linux-armv6hf.jar;C:\Code\Java\Libraries\jogamp-all-platforms\jar\gluegen-rt-natives-solaris-amd64.jar;C:\Code\Java\Libraries\jogamp-all-platforms\jar\gluegen-rt-natives-windows-amd64.jar;C:\Code\Java\Libraries\jogamp-all-platforms\jar\jogl-all-natives-macosx-universal.jar;C:\Code\Java\Libraries\jogamp-all-platforms\jar\gluegen-rt-natives-macosx-universal.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA Community Edition 12.1.4\lib\idea_rt.jar" com.intellij.rt.execution.application.AppMain SimpleScene
Catched FileNotFoundException: C:\Code\Java\Libraries\jogamp-all-platforms\jar\gluegen-natives-windows-amd64.jar (The system cannot find the file specified), while addNativeJarLibsImpl(classFromJavaJar class com.jogamp.common.os.Platform, classJarURI jar:file:/C:/Code/Java/Libraries/jogamp-all-platforms/jar/gluegen.jar!/com/jogamp/common/os/Platform.class, nativeJarBaseName gluegen-natives-windows-amd64.jar): [ file:/C:/Code/Java/Libraries/jogamp-all-platforms/jar/gluegen.jar -> file:/C:/Code/Java/Libraries/jogamp-all-platforms/jar/ ] + gluegen-natives-windows-amd64.jar -> slim: jar:file:/C:/Code/Java/Libraries/jogamp-all-platforms/jar/gluegen-natives-windows-amd64.jar!/
Exception in thread "main" java.lang.UnsatisfiedLinkError: Can't load library: C:\Code\Java\Games\Rust\gluegen-rt.dll
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1846)
at java.lang.Runtime.load0(Runtime.java:795)
at java.lang.System.load(System.java:1061)
at com.jogamp.common.jvm.JNILibLoaderBase.loadLibraryInternal(JNILibLoaderBase.java:551)
at com.jogamp.common.jvm.JNILibLoaderBase.access$000(JNILibLoaderBase.java:64)
at com.jogamp.common.jvm.JNILibLoaderBase$DefaultAction.loadLibrary(JNILibLoaderBase.java:96)
at com.jogamp.common.jvm.JNILibLoaderBase.loadLibrary(JNILibLoaderBase.java:414)
at com.jogamp.common.os.DynamicLibraryBundle$GlueJNILibLoader.loadLibrary(DynamicLibraryBundle.java:388)
at com.jogamp.common.os.Platform$1.run(Platform.java:203)
at java.security.AccessController.doPrivileged(Native Method)
at com.jogamp.common.os.Platform.<clinit>(Platform.java:173)
at javax.media.opengl.GLProfile.<clinit>(GLProfile.java:82)
at SimpleScene.main(SimpleScene.java:8)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
Process finished with exit code 1
Anyone know what's wrong with it?
I didn't cut out the unneeded files. You can see the list of files to use here.
I had the same problem.
In addition to adding the Jars files, you also need to set the dll directory when configure your interface.
At User Libraries window (here is Eclipse), expanding each one of the Jars, edit the native library location. When asked for the directory, go to the folder containing the .dlls files. (probably will be /lib)
I followed this tutorial: http://sites.google.com/site/justinscsstuff/jogl-tutorial-1
and this forum: http://forum.jogamp.org/Jar-reference-td3346099.html
Good lucky!
Rename file gluegen-rt-natives-windows-amd64.jar in the jogl installation directory to gluegen-natives-windows-amd64.jar. It's weird that for some reason the runtime tries to load file gluegen-natives-windows-amd64.jar instead of gluegen-rt-natives-windows-amd64.jar

no usbJava in java.library.path

I got a .jar file from a code that works on Windows, and I'm trying to run it on Linux, but I keep getting this message, and don't know what to do.
Exception in thread "Thread-0" java.lang.UnsatisfiedLinkError: no usbJava in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1856)
at java.lang.Runtime.loadLibrary0(Runtime.java:845)
at java.lang.System.loadLibrary(System.java:1084)
at ch.ntb.usb.LibusbJava.<clinit>(LibusbJava.java:366)
at ch.ntb.usb.USB.init(USB.java:315)
at ch.ntb.usb.USB.getBus(USB.java:296)
at ch.ntb.usb.Device.initDevice(Device.java:102)
at ch.ntb.usb.Device.open(Device.java:222)
at TransmitterModuleHIDInterface.run(TransmitterModuleHIDInterface.java:28)
at java.lang.Thread.run(Thread.java:722)
I'm using the Java wrapper for the libusb-0.1 (I followed the installation instructions here).
Any help would be really appreciated!
You need to create a link to the shared library, as per the Linux installation instructions:
http://libusbjava.sourceforge.net/wp/?page_id=8
If you're having trouble building the shared library this might be of some help:
http://me.opengroove.org/2010/01/libusbjavaso.html
The sources for the library itself is under /libusbjava/trunk/LibusbJava/ in the SVN source tree.

Categories