java.lang.UnsatisfiedLinkError: no JMagick in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1754)
at java.lang.Runtime.loadLibrary0(Runtime.java:823)
at java.lang.System.loadLibrary(System.java:1045)
when trying to use the code
ImageInfo info;
try {
info = new ImageInfo();
//image = new MagickImage(info);
} catch (MagickException e) {
logger.error(InsightsHelper.getStackTrace(e));
}
any ideas why this is happening? I'm using eclipse on OSX
You need to add the binaries that you compiled to the path so that Eclipse can see it.
First add JMagick.jar as a library, then in the the project properties-> Java Build Path -> Libraries, you click on the jmagick jar that you added to this project and edit the location for "Native library", which in this case it'll be where libJMagick-6.2.6.dylib is located since that's what the link that you provided says.
The simple answer is that the JVM is trying to find a native library used by JMagick, and failing. Either you don't have the native library at all, or it is not where the JVM is looking for it.
I downloaded a package for osx from here: joggame.com/software/jmagick.html ran the configure/make/make install and all went well. What else would I have to set up for java to find it?
You need to figure out where "make install" installed the native DLL and tell Java to look for it in the right place:
If you are launching from within Eclipse, follow the procedure in trigoman's answer.
If you are launching from the command line, directly or via a script, then you need to include this option (or the equivalent) in your java command:
java -Djava.library.path=/some/folder/ ....
Note that this is a JVM option and has to go before the classname.
Related
I am using Scala IDE 4.4.1.,using the jdk 8.When I try to run a scala program ,getting the error "Error: Could not find or load main class example.Credit" .
I was stuck with the same error a few days ago. In my case, it was an incompatibility of my JDK and the selected target JVM for my Scala project.
To check your current Java version, run java -version on the command line. To check your project JVM target in Eclipse, go to "Project > Properties > Scala Compiler" and check the target JVM (choose the same version as your current Java).
Hope it helps.
You should write object instead of class
I was having the same problem so that is how I came to this link & would like to share my findings. In my case I found that incompatible jars where present due to it was throwing error. After providing correct jar issue was resolved.
I used Scala for Eclipse IDE,
The solution for this could be right click on project and select scala -> Set the Scala Installation, will set the scala path to this project and rebuild the same.
Hope this helps you.
If the above mentioned solutions are already configured in your system and still getting this error then consider reading my answer. When incompatible scala jars are referenced by projects, a red cross mark is shown at project level and no errors are shown in scala files. In this situation scala code doesnt compile and when executed shows the message "error could not find or load main class scala". Best solution is to go to the scala installation folder and to check if the jar is present there, if present then reference it else reference jar files that do not show error (red mark) at project level or at source code.
I'm encountering a problem with the build of my JavaFX project with the Leap Motion.
When I run the file.jar, the application's window is opening, but when I call the leap motion, it's not working any more.
I have the following error :
Native code library failed to load.
java.lang.UnsatisfiedLinkError: no LeapJava in java.library.path
Yet, I have configured the buildpath. I have added the leapJava.jar, with the native library x64.
I don't understand why it doesn't work ?
Anyone with an idea ?
Thanks
The LeapJava.dll is missing or the Java library path is not set up correctly. Please have a look at the docs - setting up a project:
https://developer.leapmotion.com/documentation/java/devguide/Project_Setup.html
I have followed each step in the Eclipse section. :/
Firstly, since you haven't mentioned any specification about your system, I am answering this in context with a 64 bit Ubuntu machine.
You will posses a libLeap.so and a libLeapJava.so in 'YourDeveloperKitDirectory'/LeapSDK/lib/x64/ . These files should be copied to your /usr/lib and the configuration/bulid path (if using IntelliJ IDE -> 'Edit Configurations'->'Application'->'configuration'->'VM options'->"-Djava.library.path=/usr/lib") should be appropriately stated.
Save and run your application.
I had this problem, what solved it was adding -Djava.library.path=/Path/to/LeapDeveloperKit_2.3.1+31549_mac/LeapSDK/lib to the command line call for the .jar file. (make sure your developer kit is the right version)
So rather than:
java -jar leapMotionProgram.jar
It had to be:
java -jar -Djava.library.path=/Path/to/LeapDeveloperKit_2.3.1+31549_mac/LeapSDK/lib leapMotionProgram.jar
I am very new to Java and I am trying to run a program I got from a friend. I keep getting this error and I'm unsure how to solve the problem.
Application is starting. Fetching data. Please wait... (approx. 10s)
Exception in thread "main" java.lang.UnsatisfiedLinkError: Could not load SWT library. Reasons:
no swt-cocoa-4236 in java.library.path
no swt-cocoa in java.library.path
Can't load library: C:\Users\Andrew.swt\lib\win32\x86_64\swt-cocoa-4236.dll
Can't load library: C:\Users\Andrew.swt\lib\win32\x86_64\swt-cocoa.dll
at org.eclipse.swt.internal.Library.loadLibrary(Library.java:331)
at org.eclipse.swt.internal.Library.loadLibrary(Library.java:240)
at org.eclipse.swt.interal.C.<clinit>(C.java:21)
at org.eclipse.swt.widgets.Display.<clinit>(Display.java:101)
at view.MainWindow.open(MainWindow.java:77)
at view.MainWindow.main(MainWindow.java:65)
Apparently I'm missing the SWT library (swt-cocoa-4236 and/or swt-cocoa?), but I have no idea where to get it. That statement probably reveals my ignorance. If anyone could even point me in the right direction to where I might be able to solve the problem I'd be very grateful. Thanks!
Seems like the program that you are running is not built for your OS. SWT is OS dependant and JVM depedant. All SWT programs will use swt.jar which will be different based on the underlying OS. The one the program is using is built for Mac OS and seems like you are running that on a non-Mac system.
Regarding 'How to solve it', it depends on how the program that you are running is packaged.
Check the java version you are using and download appropriate SWT jar file.
I think Mubin (i.e. the above answer) is correct. here is where you can download the specific version of SWT.jar for your environment http://www.eclipse.org/swt/.
(I am answering your question for "I have no idea where to get it.")
little late to the game, but i just had the same problem and found this solution:
Here's what worked for me:
Right Click on your Project Folder of your HelloWorldSWT Project-> Properties -> Java Build Path -> Tab 'Projects'
Expand the 'org.eclipse.swt.cocoa.macosx.x86_64' folder by clicking on the arrow left to it
Select 'Native library location' and click Edit
Click the Workspace Button and select 'org.eclipse.swt.cocoa.macosx.x86_64', then click ok (serveral times).
That did the trick ... Ma-an
I have problems adding openCV to the buildpath of my eclipse-project. I have followed the instructions in the tutorial on this site: http://docs.opencv.org/2.4.4-beta/doc/tutorials/introduction/desktop_java/java_dev_intro.html#create-a-simple-java-project-in-eclipse
But executing the code fragment gives this console output:
Exception in thread "main" java.lang.UnsatisfiedLinkError: no opencv-java2.4.4 in java.library.path
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.loadLibrary0(Unknown Source)
at java.lang.System.loadLibrary(Unknown Source)
at camStatisticsTests.RawTests.main(RawTests.java:20)
What do I have to do in order to get openCV working with java and eclipse. i want to use it as a normal java library.
I had the same problem.
It happened because I had a mistake with the 'Native library location' configuration:
Goto Eclipse -> Window -> Preferences:
Goto User Libraries:
Make sure that your native library location path is (change c:/opencv-2.4.9 to your own opencv folder):
C:/opencv-2.4.9/build/java/x64
and not:
C:/opencv-2.4.9/build/x64
(I missed the /java folder...)
The OpenCV java library is correctly linked to your Eclipse project.
The problem is the OpenCV native library which is not in the java.library.path. The exception is thrown by the line
static{ System.loadLibrary("opencv_java244"); }
which link the java library to the native one.
When you install OpenCV on your computer, it will also install a native dll library somewhere on your system, and when you call the System.loadLibrary, you tell java to search and load this library.
Your current problem is Java can not find this library in your System, either because the library is not in one of the java.library.path folders, or because you have not OpenCV installed (also take a look at the version, maybe you have not the 2.4.4 because the last is 2.4.5, in which case you will have to adapt the String).
I just noticed that your exception is about "opencv-java2.4.4". Be sure to have the right spelling of the form "opencv_java244", in your System.loadLibrary call.
I also redirect you to one of my answer, which is related to JavaCV, but that explain in more details what is going under.
I found a solution. The actual dll is located in the openCV\opencv\build\java\x64\ folder. In my case, its name is opencv_java247.dll, so I have changed System.loadLibrary("opencv_java244") to System.loadLibrary("opencv_java247") in my java code. I also put the native library location as E:/Sagar_tools/tools/openCV/opencv/build/java/x64 (which is my full path to the dll).
For me, Eclipse > external jar > native library config = opencv/build/lib
worked
I have found the solution. The tutorial skips the step, where one has to add a dll to the "native build path". The dll is located in "opencv/build/java/x86" for 32-bit java i guess. although i dont know why this is the case. Would be nice, if someone could explain that.
Change the code to System.loadLibrary("opencv_java244")
hope you would set the native path to correct folder and opencv jar has set in build path
I'm building an Eclipse RCP application against Eclipse 3.7.1 and Java 1.6.
I'm also using Tycho to build, and have set up my RCP according to the Tycho tutorial from the EclipseCon 2011, to which I've stuck slavishly, apart from project names.
The application builds fine up until I get to Step 5 (adding a p2 repo, then adding a .product file. Well, it still builds fine, and everything is where it should be, but I cannot start the RCP by clicking on the .exe file from the repository in the workspace.
All I get is the old dreaded "The [RCP] executable launcher was unable to locate its companion shared library" error popup.
First of all I thought I might have set up the CLASS PATH incorrectly, but when I open a console and type javaw or java -version anywhere, it all works.
Also, when I go to the pluginsfolder in the p2 repository for the RCP in the workspace, and double-click on org.eclipse.equinox.launcher_1.2.0.v20110502.jar, the RCP starts, albeit without the splash screen.
This must surely mean my Java set up is correct, and it's not a class path problem?
I'm not sure where this problem might lie (I have a plugin, a feature, a product, a repository, and a parent package with the main pom), so if you let me know your suspicions where the error might come from, I'll be more than happy to post respective XML, build.properties, screenshots and what have you. Unless this is a common error with a common solution.
Many thanks in advance!
Oh yea: Windows 7 (64-bit), JDK and JRE both 64-bit as well, Eclipse EE 3.7.1 (I chose that because it contains the most plugins I'll need later by default).
UPDATE
I'm attaching my CLASS PATH Settings for reference.
User variables
CLASS PATH: C:\Program Files\Java\jdk1.6.0_30;.;
System variables
JAVA_HOME: C:\Program Files\Java\jdk1.6.0_30
Path: %JAVA_HOME%\bin;
UPDATE 2
When I let Tycho create a ZIP file in the p2 repository, and copy that from the repo to another location, unzip it and run the .exe, the application starts without problems. So I guess this query is partially solved, but I'd still be interested to hear why I wouldn't be able to start the application from the repository...
Today I came across the same issue. I guess you could find the solution here: https://bugs.eclipse.org/bugs/show_bug.cgi?id=176084
In short, the problem in my case was, that the org.eclipse.equinox.launcher_1.2.0.v20110502.jar must be unpacked in the plugins folder under the folder name: org.eclipse.equinox.launcher_1.2.0.v20110502
... hope that helps!
In my case the error The [RCP] executable launcher was unable to locate its companion shared library was because my path was too long.
Same issue I was facing from yesterday. Today, I have changed path of project(git clone) and build it and able to run RCP executable.
I think this issue was because of path too long.