Hey I'm running Eclipse and I'm making a project that uses JMyron and apparently I need to copy a .dll to the root of my project... what is that and how do I do it in Eclipse (I'm a noob).
Note... I also have to add a .jar to my classpath
Related
I am trying to communicate to Arduino with Java, so I'm using the rxtx library. I've downloaded the library and placed the respective files in my java project's folder. I put the rxtxxjar in a lib folder in the java project's folder, and I left the serial.jnlib straight into the java project's folder. I've taken the SerialTest code off of the arduino website, and I've tried to run it but I keep getting the UnsatisfiedLinkError. I've researched this question, and I've seen people saying basically the following in different ways:
Go to Project -> properties -> Java build path ->Find your .jar. Click
on + to open the JAR's properties. Select Native library location and
edit it to point to RXTX's shared library (.DLL, .so, .dylib).
However, I have no idea how to do the pointing to the shared library, especially since I don't see any .dll, .so, or .dylib file, and I cannot use the .jnlib because it is greyed out. Also on a smaller note, by my .jar is that just the project? I work in Eclipse Java EE.
You can use
System.load("Absolute path to your jni library");
This works fine on my project.
I'm using a .jar library that needs additional .dll or .so to function.
I copied them in a folder in my eclipse project and then added that folder to the native library location in Properties -> Java Build Path -> Libraries. When I start my application in eclipse, it works well but when I export it as a runnable jar and then execute it, it doesnt work anymore and gives me a java.lang.UnsatisfiedLinkError error.
Is there a possibility to add these additional files inside the .jar and also add them to the java.library.path variable when running the application?
Regards
I would suggest creating new resources folder in Eclipse (if you are using it, since that folder will be on classpath), or just add it manually to classpath.
I have a Java project in Netbeans, which uses Java3d. When I distribute the jar file, it doesn't work. I tried various ways to add the files vecmath.jar, j3dutils.jar, j3dcore.jar, but they seem to be ignored. I tried to run the resulting jar on another PC with Windows XP, and I asked a friend to try it on Mac, and it didn't launch.
What I tried so far and didn't work (based on answers on the Internet, some maybe don't make sense, but I tried everything I could find):
check enable native packaging actions in project menu
distribute the dist folder, including a folder named lib generated by Netbeans, with the three Java3d jars
right click the project, Properties->Libraries, and add there the Java3d jars
right click the Libraries folder under the project, and add jar/folder
include a folder with the jars in the src folder
create a library with "Add Library..." from "Project Properties", in the "Global Libraries" folder, and added it to the project.
Nothing worked.
If I make a Windows installer with "Package as", the installation works on Windows XP (although if I doubleclick the jar, is not launched). How can I make an installer for Mac?
To resume, the questions are:
How can I distribute the Java3d jar files so that it works on other computers?
In particular, I am interested for Mac
Update
Here is the error I get when running the jar file on Windows XP:
java.lang.UnsatisfiedLinkError: no j3dcore-ogl-chk in java.library.path
I added the dll files, and it works. I have to see how I make it work on Mac.
I have created an application using the JFreeChart library for use on another machine.
Previously I have developed applications with JFreeChart (using the same libraries) which has worked fine on other machines. The only difference is this machine is running Vista.
Please see below for the run-time exception I am getting:
The class that cannot be found, however, is located in the highlighted jar in the below image showing my imported libraries for the JAR. I have also established that this JAR is included in the manifest for the application. See below image:
So I very much need this to work and have no idea where to look next - or what is causing this problem!
Development machine Java version:
1.7.0_45
Target machine Java version:
1.7.0_45
Thanks in advance.
Check the Class-Path attribute in your JAR's manifest, which should contain entries like this:
Class-Path: lib/jfreechart-1.0.17.jar lib/jcommon-1.0.21.jar …
Also, examine dist/README.TXT in your NetBeans project folder, which should say something like this regarding libraries required by your project:
To run the project from the command line, go to the dist folder and
type the following:
java -jar "CISOnlineMonitor.jar"
To distribute this project, zip up the dist folder (including the lib folder)
and distribute the ZIP file.
This has nothing to do with os i belive.You dont have all the necessery libs within your jar.Try to open a jar and see if you have them in.Fact that you are able to run it on your maschine only proves that.Make executable jar with eclipse or whathever you use.And when it ask you for libs check -Extract required libraries into generated Jar.
if you dont know how to get to that point
File>Export>Java>Runnable Jar File> Runnable JAR File Specification.
Also right click on your project and check Your build path.
RightClick project>Properties>Java Build Path>Libraries
Make sure you have everything correct
EDIT-
As i see you use NetBeans im not sure exactly how to find all this there.Bud it will be very similiar.
I created a runnable .jar file from a project I built in Eclipse Juno. The project uses the JRE7 and JavaFX libraries, which I added to the build path.
Build Path Settings
The .jar file executes successfully on Windows 7 machines. However, when I try to run the .jar file on a WindowsXP machine, it fails with the following linking error:
Error on WindowsXP
The error reads:
Exception in thread "AWT-EventQueue-0" java.lang.UnsatisfiedLinkError: com.sun.glass.ui.win.WinApplication._invokeLater(Ljava/lang/Runnable;)V
at com.sun.glass.ui.win.WinApplication._invokeLater(Native Method)
at com.sun.glass.ui.Application.invokeLater(Application.java:338)
at com.sun.javafx.tk.quantum.QuantumToolkit.defer(QuantumToolkit.java:620)
The error occurs just as the program tries to load a class that uses JavaFX, The WindowsXP machine has Java Version 7 Update 40 which comes with JavaFX, so I can't figure out why it would fail.
Could this be a 32-bit vs. 64-bit problem?
Also, on the build path settings, I wonder if I'm including the right JavaFX jar file. I have two to choose from and I'm not exactly sure which one to include. I assume it's the second one because it's part of the JRE.
C:\Program Files\Java\jdk1.7.0_25\jre\lib\jfxtr.jar
C:\Program Files (x86)\Java\jre7\lib\jfxtr.jar
Thanks
1. JavaFX is embedded into JRE, but it is the separate library still now. So, if you use the JavaFX classes in your project, JVM should "know" about that. Your *.jar file should contain info about jfxrt.jar. How to do that?
2. JRE folder used for running the apps, such as *.jar files. JDK/JRE folder used when you developing your apps from IDE. So, you should use the C:\Program Files\Java\jdk1.7.0_25\jre\lib\ path for your project build path' libs.
As far as I know, there is no way to run JavaFX applications on Windows XP.
Despite all of my efforts, I couldn't get the .jar file to execute in Windows XP when I created it in Eclipse. But I could get it to work when the project was exported out of NetBeans. The trick was: I created a new "JavaFX in Swing Application" in NetBeans. That way, the IDE imported all of the necessary libraries for JavaFX. I copied all of my .java files from Eclipse into the new NetBeans project and it worked. Happy with NetBeans!