I am trying to use an applet I downloaded. I get the following error when using it
Can't load library 'friend'.
java.lang.UnsatisfiedLinkError:no friend in java.library.path
No resource '/libfriend.so' found.
Please help. Thank you.
the application is looking for a native library called libfriend.so in your path. I'm assuming you're on linux, if so and you have the .so file you can add it to your path, if you are on windows you are out of luck.
Related
I tried downloading the open DMX java wrapped form here. I'm using Eclipse as IDE. When I run the example I got the java.lang.UnsatisfiedLinkError openDMX.
So I googled the hell out of it and I found out that I had to define the build path of the dll file (from what I found this had to do with the driver for the usb device?)
I tried the following:
Definde the path in run configurations->vm arguments and then -Djava.library.path=dll
as was included in the readme. This gave the same exception
Then I found that I could define the build path. Right clicked the main folder in the file browser in eclipse.
Then properties->libraries->JRE system libraries->native library location
I browsed in the workspace for de dll folder and set the opendmx_example/dll as the native library location
Stil: Exception in thread "main" java.lang.UnsatisfiedLinkError: no opendmx in java.library.path
Does somebody experience the same trouble or is it something that I'm doing wrong
Any help is much appreciated!
I need to create a runnable jar in Windows with Eclipse and start it with Linux
I'm getting an unsatisfiedLinkError while loading OpenCv. I have edited the correct library path for a Linux computer in Eclipse and finally created a runnable jar. When I start the *.jar file in linux and get the following error.
Exception in thread "main" java.lang.UnsatisfiedLinkError: no
opencv_java2411 in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1889)
at java.lang.Runtime.loadLibrary0(Runtime.java:900)
at java.lang.System.loadLibrary(System.java:1087)
Basically i have two question.
1. How can i get the loaded library path at runtime?
2. Is it possible that the chosen way is not the right way to handle the problem?
Thanks
One important this to keep in mind for loading linux libraries with System.loadLibrary, omit the lib prefix in the library name, for instance, if the library name is libxyz.so, your call would be:
System.loadLibrary("xyz");
Set the path of OpenCV in the variable LD_LIBRARY_PATH. You can do it in the shell where you run the "jar". Use export command.
I'm a little confused by this error. I'm new to Java and the error seems pretty self explanatory, but I've checked my paths (even defined my own) and it still fails to find this library. Is there something I'm doing wrong? See directory screenshot and error screenshot below:
UPDATE
UPDATE 2
If I create a new NetBeans project this works fine. Same code and everything. If I create new IntelliJ project I get this error above. I must be missing something in IntelliJ
UPDATE 3
Found the solution. Adding dependencies is a bit different in IntelliJ. Thanks all for the help.
http://www.jetbrains.com/idea/webhelp/configuring-module-dependencies-and-libraries.html
Obidisc4j is a .jar file. You just dont see its extension in the explorer.
Regular jar files are not loaded by System.loadLibrary. They are automatically loaded by the JVM's classLoader.
You are using a native library. It doen't matter if that library is in the classpath. There are 4 ways you can make the Java runtime load your shared library at runtime:
Call System.load to load the .so from an explicitly specified absolute path.
Copy the shared library to one of the paths already listed in java.library.path
Modify the LD_LIBRARY_PATH environment variable to include the directory where the shared library is located.
Specify the java.library.path on the command line by using the -D option.
Seems like your application is trying to find out a obidisc4j.dll (for Windows) or obidisc4j.so (for Linux). The file must be present on the PATH (but not the classpath). If you are not sure what PATH is your Java application searching in, you can write the following statement, before the point where the exception takes place, to find out the PATH.
System.out.println(System.getProperty("java.library.path"));
This will tell you about the paths where your DLL or SO file should be placed. You just need to place the file in ONE of those N-paths.
I am trying to use jinput with a wrapper library (procontroll) in a Java application on OS X.
The problem is in the jinput library. When control gets to net.java.games.input.OSXEnvironmentPlugin's System.loadLibrary call, which looks for "jinput-osx", this call throws an UnsatisfiedLinkError.
I have downloaded the latest jinput libraries from jinput.dev.java.net, discovered the java.library.path for my application by println()'ing it, and put both the jinput.jar and libjinput-osx.jnilib files in this directory.
Does anyone have ideas as to why this library isn't loading or how to fix it? Thanks.
go to Project->Propertity->Java Build Path->Libraries-> JRE->Native Livary->edit:
add the library folder containing jinput-osx as the external folder
I need to find the installation directory of a Java application. I will use it to find recourses that are not on the classpath. What is the best solution for it?
This code will give you the location of class file in System from where it is being executing.
this.getClass().getProtectionDomain().getCodeSource().getLocation();