JPL/SWI Prolog not working - java

I'm trying to use the SWI-Prolog JPL library, but I'm having problems.
I'm trying to let my Eclipse project access JPL, but when I try to start the program, I get the following error:
Exception in thread "AWT-EventQueue-0" java.lang.UnsatisfiedLinkError: no jpl in java.library.path
I copied the jpl.jar into my project directory, and I set it on the build path. Additionally, I pass the following VM arguments:
-Djava.library.path="C:\Program Files\Prolog\bin"
(That's the directory where Prolog was installed).
What am I doing wrong?
EDIT: I don't seem to have the libpl.dll anywhere on my computer. Could this be causing my problem?

The jvm.dll of your running JDK/JRE must be available in your system PATH so that jpl.dll from java.library.path loads properly.
You have to take care to 32 bits / 64 bits consistency between your JPL installation and your running JVM - so do not try any mix.
Here is information from an old installation doc.
For such installation support, you should use the JPL mailing list.

You should set the java.library.path to the folder where the jpl.dll file is located. As far as I know it is the Prolog\bin folder.

A system-wide solution in a Mac environment (SWI-Prolog version 7.1.4 for x86_64-darwin13.1.0) would be to create the following symlink:
ln -s /usr/local/Cellar/swi-prolog/7.1.4/libexec/lib/swipl-7.1.4/lib/x86_64-darwin13.1.0/libjpl.jnilib /Library/Java/Extensions/libjpl.jnilib

Could be rather
ln -s
/Applications/SWI-Prolog.app/Contents/swipl/lib/x86_64-darwin/libjpl.dylib
/Library/Java/Extensions/libjpl.dylib
? (no .inilib was found under darwin folder)
In my case still error on mojave (SWI-Prolog (threaded, 64 bits, version 8.0.2)):
Jan 03, 2020 12:10:55 AM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [ACTIONS] in context with path [/SVIZ] threw exception [Servlet execution threw an exception] with root cause
java.lang.UnsatisfiedLinkError: /Applications/SWI-Prolog.app/Contents/swipl/lib/x86_64-darwin/libjpl.dylib: dlopen(/Applications/SWI-Prolog.app/Contents/swipl/lib/x86_64-darwin/libjpl.dylib, 1): Library not loaded: #rpath/libswipl.8.dylib
Referenced from: /Applications/SWI-Prolog.app/Contents/swipl/lib/x86_64-darwin/libjpl.dylib
Reason: image not found

Related

JNI library missing

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.

java.lang.UnsatisfiedLinkError: ars3wapi32 still after updating path variable

I am trying to set up On Demand Server in my local machine and when ever I am deploying the application on tomcat server I am getting below error message on browser. I have updated the PATH variable also.
root cause
java.lang.UnsatisfiedLinkError: ars3wapi32 (Not found in java.library.path)
java.lang.ClassLoader.loadLibraryWithPath(ClassLoader.java:1007)
java.lang.ClassLoader.loadLibraryWithClassLoader(ClassLoader.java:971)
java.lang.System.loadLibrary(System.java:470)
com.ibm.edms.od.ArsWWWInterface.<clinit>(ArsWWWInterface.java:15)
java.lang.J9VMInternals.initializeImpl(Native Method)
java.lang.J9VMInternals.initialize(J9VMInternals.java:200)
com.ibm.edms.od.ODServer.<init>(ODServer.java:45)
com.ibm.edms.od.ODServer.<init>(ODServer.java:61)
com.uklife.web.ondemand.utils.DownloadUtils.getAFPDocumentFromOnDemand(DownloadUtils.java:80)
com.uklife.web.ondemand.utils.Utils.getDocument(Utils.java:288)
com.uklife.web.ondemand.servlet.OnDemandDocAccess.doGet(OnDemandDocAccess.java:81)
javax.servlet.http.HttpServlet.s`enter code here`ervice(HttpServlet.java:621)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722
)
Here is a guide the solution (for Windows and OnDemand V9.5).
First of all, you need to install ODWEK on the machine where you want to run your java app. Please install in the default folder, this whole thing is tricky enough as it is...
Set the environment variable "PATH" in Windows, add "C:\Program Files\IBM\OnDemand\V9.5\bin"
Set CLASSPATH in your development environment - point out the ODApi.jar file and ALSO point "Native library..." to the \bin folder above. (You can also call the program and setting the CLASSPATH in the call as a parameter: -Djava.library.path="C:\Program Files\IBM\OnDemand\V9.5\www\api\ODapi.jar"
Copy the file ars3wapi64.dll from C:\Program Files\IBM\V9.5\www to C:\Program Files\IBM\OnDemand\V9.5\bin
Ensure that all of these files are in the bin-catalog above:
**ars3wapi64.dll**
icudt53.dll
icuin53.dll
icuio53.dll
icule53.dll
iculx53.dll
icuuc53.dll
arsgsk64.dll
If you are getting the error "java.lang.UnsatisfiedLinkError: ars3wapi32 (Not found in java.library.path)" one of the above is most likely incorrect.
OR you could be using different versions of ODWEK and OnDemand.
More on how to set CLASSPATH in Eclipse: How to set the java.library.path from Eclipse

Can't find/load swt-gtk

I'm trying to run an internal web browser using JWebBrowser. When I run the application in Netbeans environment it works perfectly. However, when I build the project and run the jar file I'm getting the following error:
NativeSwing[1]: Exception in thread "main" java.lang.UnsatisfiedLinkError: Could
not load SWT library. Reasons:
NativeSwing[1]: no swt-gtk-3721 in java.library.path
NativeSwing[1]: no swt-gtk in java.library.path
NativeSwing[1]: Can't load library: C:\Users\CCS.swt\lib\win32\amd64\swt-gtk-3721.dll
NativeSwing[1]: Can't load library: C:\Users\CCS.swt\lib\win32\amd64\swt-gtk.dll
I'm including the following libraries to the project:
DJNativeSwing.jar
DJNativeSwing-SWT.jar
DJNativeSwing-SWTAPI.jar
DJNativeSwing-SWTCore.jar
MozillaInterfaces-1.8.1.3.jar
swt.jar (version 3.7M5 for 64 bits.)
jna_WindowUtils.jar
jna-3.2.4.jar
and they're referenced by Manifest.MF by this way
Class-Path: lib/DJNativeSwing-SWT.jar lib/DJNativeSwing-SWTAPI.jar lib
/DJNativeSwing-SWTCore.jar lib/MozillaInterfaces-1.8.1.3.jar lib/DJNa
tiveSwing.jar lib/swt.jar lib/jna-3.2.4.jar lib/jna_WindowUtils.jar
What am I doing wrong?
Thank you.
You need to specify the java.library.path in the java command and aim it at the path to your .dll files. For example,
java -Djava.library.path=lib -cp ...
Ok, I found the solution. The problem was about the dll generation. I was using 3.7m5 version, I downloaded a previous version (3.7) and the application ran properly.
Thank you for your help.
Regards.

SWT Browser not working?

I'm having a little trouble with the SWT Browser component.
I am running Ubuntu 11.04 AMD64 and Eclipse 3.7, with Java SE 1.6 from Sun
My problem is that my browser won't initialize. When I make it with the SWT.NONE flag, I get errors
Exception in thread "main" org.eclipse.swt.SWTError: No more handles (java.lang.UnsatisfiedLinkError: no swt-mozilla-gtk-3346 or swt-mozilla-gtk in swt.library.path, java.library.path or the jar file)
at org.eclipse.swt.SWT.error(SWT.java:3589)
at org.eclipse.swt.SWT.error(SWT.java:3481)
at org.eclipse.swt.browser.Mozilla.create(Mozilla.java:324)
at org.eclipse.swt.browser.Browser.<init>(Browser.java:109)
at browser.Main.createGUI(Main.java:40)
at browser.Main.main(Main.java:21)
Caused by: java.lang.UnsatisfiedLinkError: no swt-mozilla-gtk-3346 or swt-mozilla-gtk in swt.library.path, java.library.path or the jar file
at org.eclipse.swt.internal.Library.loadLibrary(Library.java:219)
at org.eclipse.swt.internal.Library.loadLibrary(Library.java:151)
at org.eclipse.swt.browser.Mozilla.create(Mozilla.java:309)
... 3 more
And then when I try to use the SWT.MOZILLA flag, I get
Exception in thread "main" org.eclipse.swt.SWTError: No more handles [Could not detect registered XULRunner to use]
at org.eclipse.swt.SWT.error(SWT.java:3589)
at org.eclipse.swt.browser.Mozilla.create(Mozilla.java:280)
at org.eclipse.swt.browser.Browser.<init>(Browser.java:109)
at browser.Main.createGUI(Main.java:40)
at browser.Main.main(Main.java:21)
I suspect this is partly because I am using XULRunner2, but I would prefer to use WebKit, which in Eclipse 3.7 (that's why I upgraded), should be default when using SWT.NONE.
If any of you have run into this problem and/or have solved it before, I would appreciate it if you could help me.
Thanks!
According to SWT FAQ you may have unsupported XULRunner2 (try older versions). You should also check if you have installed WebKitGTK+ 1.2.x for WebKit browser core.
EDIT
Edited based on your comments. Accordingly to this FAQ you should have WebKitGTK 1.2.0 or newer in the library load path, so check if you have.. And create browser with SWT.NONE..
The error message you get from SWT said so you don't have the library on the path you should
java.lang.UnsatisfiedLinkError: no swt-mozilla-gtk-3346 or swt-mozilla-gtk in swt.library.path, java.library.path or the jar file

LibraryNotFoundException while running java code that invokes dlls

I have written a code that requires 2 dll's at runtime.I have those dll files in C:\Program Files\Java\jdk1.6.0_01\jre\bin.
I have set the environment variable PATH accordingly.
It compiled successfully and then while running it gives the following error:
Exception in thread "main" java.lang.ExceptionInInitializerError
at teamdev.jxcapture.Capture.captureActiveWindow(Unknown Source)
at ppb.activewindow.execute(activewindow.java:24)
at ppb.activewindow.main(activewindow.java:68)
Caused by: com.jniwrapper.LibraryNotFoundException: Cannot find JNIWrapper nativ
e library (jniwrap.dll) in java.library.path: C:\Program Files\Java\jdk1.6.0_01\
jre\bin\jniwrap.dll
Could anybody please help me to resolve this problem?
The value of java.library.path should be the directory containing the DLLs, not the filename of the DLLs themselves. It looks like your java.library.path is set to
C:\Program Files\Java\jdk1.6.0_01\jre\bin\jniwrap.dll
instead of
C:\Program Files\Java\jdk1.6.0_01\jre\bin
It looks like the DLL is not being found on the Java Library Path. See this - http://www.inonit.com/cygwin/jni/helloWorld/load.html
Try moving JDK to a path without spaces.

Categories