For one of my projects I have the need to mix Java with some well established Python code, so I turned my attention to JEP as this seems to be the perfect solution to my problem. I am using Java 1.8 and Python 3.6 on Mac OSX, and my Java IDE is Eclipse.
Unfortunately, I struggle to get this to work, mainly because I am really a newby I think.
In Eclipse, I have set my Build path to include the 'jep-3.7.1.jar', and I have also linked the path to the native '.so' file to 'Users/me/anaconda3/lib/python3.6/site-packages/jep/'. So it seems like I have done everything I need, but when I try to run a simple code that calls for a Jep object I get the following naste exception:
Exception in thread "main" java.lang.UnsatisfiedLinkError: /Users/me/anaconda3/lib/python3.6/site-packages/jep/jep.cpython-36m-darwin.so: dlopen(/Users/me/anaconda3/lib/python3.6/site-packages/jep/jep.cpython-36m-darwin.so, 1): Library not loaded: #rpath/libpython3.6m.dylib
Referenced from: /Users/me/anaconda3/lib/python3.6/site-packages/jep/jep.cpython-36m-darwin.so
Reason: image not found
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1941)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1861)
at java.lang.Runtime.loadLibrary0(Runtime.java:870)
at java.lang.System.loadLibrary(System.java:1122)
at jep.Jep.<clinit>(Jep.java:217)
at mixingPython.mixJvcPyth.getDataFromPython(mixJvcPyth.java:11)
at mixingPython.mixJvcPyth.main(mixJvcPyth.java:29)/
I am sure that this is basic, but if anyone could help it would be great!
Cedric
Related
I am trying to run a test file InspectVM from libguestfs library inorder to have accesss to a disk image in windows. However, I have the following errors on my console
run:
Exception in thread "main" java.lang.UnsatisfiedLinkError: no guestfs_jni in java.library.path
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 madjava.com.redhat.et.libguestfs.GuestFS.<clinit>(GuestFS.java:51)
at madjava.examples.InspectVM.main(InspectVM.java:30)
C:\Users\CyberSOFONET\AppData\Local\NetBeans\Cache\8.2\executor-snippets\run.xml:53: Java returned: 1
BUILD FAILED (total time: 0 seconds)#
I searched allover the internet and find that I should set java.libraly.path pointing to location of the guestfs_jni. my major problem is that I do not have any file with that name guestfs_jni. Do I need to make one myself or can I find it somewhere. any kind of help is appriciated. am a newbie in JNI so I dont have much imformation on it
You're looking for a file called guestfs_jni.dll. Usually the native library comes with the jar file.
From http://libguestfs.org/guestfs-java.3.html:
Libguestfs for Java is a Java Native Interface (JNI) extension, supplied in three parts: libguestfs.jar, libguestfs-VERSION.jar, libguestfs_jni.so, libguestfs.so
So the distribution comes with libguest_jni.so which ist for Linux and not for Windows. IIRC, there is no libguestfs for Windows. So you would first have to find out if it is even possible to compile libguestfs using Cygwin and if yes build it yourself.
If you're on Windows 10 you could try installing libguestfs and a Java runtime for the Linux subsystem and run inside the subsystem.
I am trying to resolve this error that I keep getting:
java.lang.UnsatisfiedLinkError: no cplex1262 in java.library.path
java.library.path must point to the directory containing the CPLEX shared library
try invoking java with java -Djava.library.path=...
Exception in thread "main" java.lang.UnsatisfiedLinkError: ilog.cplex.Cplex.CPXopenCPLEX([I)J
at ilog.cplex.Cplex.CPXopenCPLEX(Native Method)
at ilog.cplex.CplexI.init(CplexI.java:5722)
at ilog.cplex.CplexI.(CplexI.java:611)
at ilog.cplex.IloCplex.(IloCplex.java:10384)
I am using maven with java and I am trying to call cplex library. I think something needs to change in the pom file but i dont know what. Please help. Thanks.
One possible cause for could be your dll being in 32 or 64 bits and your java being in the opposite architecture.
Try verifying that your java and cplex.dll match. I got this information from the below post UnsatisfiedLinkError, despite setting Djava.library.path variable
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.
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.
I'm new to sigar and native library programming in java, so maybe it is just a simple problem, but I can't find a result on my own.
I'm using eclipse indigo on a win 7 (64bit) OS. I've taken the following steps:
Add sigar.jar an log4l.jar to the jre6/lib, add the sigar-amd64-winnt.dll (also the files for x86) file to ./Program Files/Java/jre6/lib.
Then I only want to create a new sigar() but get the following exception:
Failed to load sigar-amd64-winnt: java.lang.NullPointerException
org.hyperic.sigar.SigarException: Failed to load sigar-amd64-winnt: java.lang.NullPointerException
at org.hyperic.sigar.Sigar.loadLibrary(Sigar.java:170)
at org.hyperic.sigar.Sigar.<clinit>(Sigar.java:100)
at MemExample.<clinit>(MemExample.java:8)
Exception in thread "main" java.lang.UnsatisfiedLinkError: org.hyperic.sigar.Mem.gather(Lorg/hyperic/sigar/Sigar;)V
at org.hyperic.sigar.Mem.gather(Native Method)
at org.hyperic.sigar.Mem.fetch(Mem.java:30)
at org.hyperic.sigar.Sigar.getMem(Sigar.java:304)
at MemExample.getInformationsAboutMemor
I've already tried to manipulate the VM-Arguments (in Run Config -DJava.library.path="path/of/lib"), to set the native library in the java build path to the path of sigar/lib and to set the Systempath in the program on my own with System.setProperty("path", "-"). All of which are unsuccessful until now.
And step by step I yield to despair.
**Edit:**Is it possible that sigar only works with AMD?
Some friend tried the same code with an AMD processor and win 7 (32b) and it works.
I already look for an answer in the hyperic sigar developer forum, but I can't find any useful tips or answers.
Seems that sigar-amd64-winnt.lib is missing: http://communities.vmware.com/message/1947455#1947455