I got the following Error as I compiled my program using the jlwgl and the slick library:
Exception in thread "main" java.lang.UnsatisfiedLinkError: no lwjgl in
java.library.path
There are really many posts on that ! But I really didn't get the solutions of any of them. I think, that for example the description on this site probably explained everything . But I don't know what they mean by:
Specify the path to it using -Djava.library.path=
It would be very kind if you could give me a step by step explanation for dummies.
I am using ubuntu 12.04 and my IDE is eclipse
From this question:
Go to the library settings for your projects and for each LWJGL library go to the tree view in the library tab. Each library has items for source, javadoc and native library locations.
Select project, right click->properties, "java build path", "libraries" tab, select a jar, expand it, select "Native library location", click "edit...", folder chooser dialog will appear)
Related
A year ago, I created an Eclipse project that was developed on Windows and deployed to Linux. I used SWT, and I was able to get it running on Linux with the appropriate SWT jar. No problems.
Recently, I started a new project with the same MO: develop on Windows, deploy to Linux, use SWT. I used the same project structure as the project that worked, but it won't work on Linux. When I try to run the new project on Linux, it hits me with an UnsatisfiedLinkError:
Exception in thread "main" java.lang.UnsatisfiedLinkError: Could not load SWT library. Reasons:
no swt-win32-4924r25 in java.library.path
no swt-win32 in java.library.path
Can't load library: /home/hmartin/.swt/lib/linux/x86_64/libswt-win32-4924r25.so
Can't load library: /home/hmartin/.swt/lib/linux/x86_64/libswt-win32.so
What looks peculiar to me is that it seems to be looking for the Windows version of the SWT jar, and I don't understand why that could be. I've fiddled with project preferences, build paths, build.xml, manifests, etc.
I do have a manifest that is supposed to tell the application where its SWT library is (in the same directory as the application jar), but I suspect that my project doesn't know it exists. With the working project I made a year ago, I remember being able to have Eclipse generate a manifest file upon export, and that's what I did. With this (broken) project, I am not able to generate a manifest file nor do I have the option of selecting one from the workspace upon export. This time, I just made a manifest file myself, followed the naming conventions, and hoped the magic happened. The magic has not happened.
Help, suggestions, recommendations, etc. are much appreciated.
After playing around with a test project and export settings, I discovered that the cause of my problems was one single check box on the JAR export screen: "Export generated class files and resources". I had this box unchecked, which meant that (for some reason) Eclipse wouldn't show me the options to generate or select a manifest. With that box checked and manifest selected, the new project now runs on the target platform.
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 have a Java Project in Eclipse, and a Java Dynamic Web Project in Eclipse. In the former, all the jar files are shown individually under the top-level project folder. In the latter, the jar files are under a Libraries folder and the navigation is more convenient.
Is it possible to organize them in the same way in the Java Project also? If so, how?
Update: It is the Project Explorer View. For the Java Project, I see: "my_project_name" with the arrow expanded to point downwards, then I see: "package_icon src/main/java" and below that "package_icon src/main/resources" and then 20 jar files one below the other: "jar_icon activation-1.1.jar", ...
For the Java Dynamic Web Project I see: "my_project_name" as above, then I see: "JAX-WS Web Services" (unexpanded), then "Deployment Descriptor" (unexpanded), then "Java Resources" which I have expandeded, so I see the components of it below, of which the first is: "package_icon src/main/java", then below it, "package_icon src/main/resources", then below it "libraries_icon Libraries" instead of 20 jars! I have the option of expanding Libraries if I really need to see the 20 jars.
The only option I found to make things prettier in Eclipse Kepler is to:
In the Project Explorer window there is a down arrow in the upper right corner. Select that and then Customize View.
Select 'Libraries from external' and then OK.
Kind of cheesy...
EDIT: Of course I had to go and do some more digging...and it looks like I'll have to try this and see how it works.
Similar to M Miller's answer (but for Juno), click Show 'Referenced Libraries' Node in the dropdown of the Package Explorer window:
I'm using:
Eclipse IDE for Java Developers
Version: Juno Release
Build id: 20120614-1722
I noticed this "feature" on Eclipse Juno (latest version), when you have a jar file added to the build path it is not shown as a single file on the project.
Try removing one of the jars from the build path to see if it shows up again.
I couldn't find how to turn it off though.
BTW... the project layout for your "Java Project" is more akin to a "Maven Project", which is a bit more powerful.
You should change into the Package Explorer by Window > show View. It will display all the referenced libraries in a Referenced Libraries folder.
I'm trying to do some simple FTP stuff in Android. After researching a little bit, I decided to go with the apache-commons-net. Here are the steps I took to get it working under Eclipse.
Downloaded the package from here and unpacked it locally.
In Eclipse, to add this new library, I go to (Window >) Preferences > Java > Build Path > User Libraries, click New, name it apache-commons-net, then Add JARs... to it by picking the .jar files that came in the download.
For each .jar, I add in the Source attachment as described here.
Once this is done, I right-click my project and choose Properties > Java Build Path > Libraries, click Add Library... > User Library > (Next >) choose apache-commons-net > Finish. The library then shows up alongside Android 2.2 in the Libraries tab.
I start programming, and code completion works fine for the classes/methods/etc. from this library. Import statements are included, etc. Everything seems to work as it should. The problem is, when I run the app, it force closes and my LogCat in Eclipse shows the following error:
Could not find class 'org.apache.commons.net.ftp.FTPClient', referenced from method <...>
...
Caused by: java.lang.NoClassDefFoundError: org.apache.commons.net.ftp.FTPClient
It seems like I've set everything up correctly, so why is the execution complaining that it can't find the class???
Any ideas or help is greatly appreciated.
Ian
You need to copy the jar(s) to the libs directory in the project. The ADK picks the libraries from that folder and convert them into classes optimized for Dalvik.
Edit
There might be some more information in this question: Importing external .jar file to Android project