Include Java3d in Netbeans dist - java

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.

Related

How can I Export my Java Project in Netbeans in Executable(.exe)?

I have completed my project but unable to export in executable form. I'm using Netbeans 12.
Java applications aren't built as exe files but as jar files. The component that makes them executable is the Main-class attribute defined in the META-INF file of the jar.
In NetBeans to turn your program into an executable jar file
1)Right Click on your project->Properties->Select Run Tab on the left corner of your screen. You will see an text box saying main class, select the drop down arrow to browse through all main classes available in your project (Yes NetBeans can have multiple main classes but will run only one)
2)Optional Select the deployment tab and select compress jar to save space
3)Right Click on project->Clean and build
Then go to your projects folder on your file explorer you will see an dist(distribution) folder and there you will see your built jar file named (Project Name).jar simply double click it and the java jre will execute it
Some people have a problem running the jar file with double clicking in that case either from cmd or from an bat file type this script
set path=<path to your java.exe in your JDK/JRE bin folder>
cd (Path to where your jar file is located)
java -jar <Your Jar file>.jar
Thanks for everyone who wanted to help me.
Easiest Solution:
Start an Ant based standard project
Enable native packaging inside Properties->Build->Deployment
Install Inno setup tool for Exe, Wix Toolset for Msi
add bin paths of above tools as system environment variables
right click on project and select package as->Exe or MSI
Note:
Netbeans 8.2 is recommended (some features are deprecated in latest version)
Screenshot
You can use Files>Export>Browse to Export in netbeans.

JFreeChart Java JAR not running on a different machine

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.

JAR File not exececuting which is build by netbeans

I am a Beginner in Java GUI and am using Netbeans 7.3 to use Swing Components, the problem is that all was working fine, but one day when I Clicked Clean & Build and tested the JAR file, it was not executing, I ran it in the Netbeans and It is working fine.
Then I thought that it would be a problem of Build Properties so I compared build properties from a project which was working fine with Jar file but I cannot find any difference, The problem is that when I double-click the JAR file, no Error is shown, I tried many ways like executing it from cmd but It did'nt worked.
Can anyone help me out What could be missing, and one thing more that is I even tried to build my project on another computer through Netbeans but no use.
Try to open your .jar with winrar, and check if the classes are being added to the .jar, If they are not being added probably is a bug from netbeans, I would advise to install netbeans 7.2, and then open your project again, and then regenerate the Jar File. I was having a similar problem with Netbeans 7.3
I think you executing .jar file from different folder - not from where it was created? If so - that means your application can not find some files - pictures, etc. So if you have some files which application uses - create the folder named "lib" and place there your files - but not .jar file. For example:
File file = new File("/images/etc.png");
means that it is placed in lib/images directory. So your .jar file could be run from here:
C:/myTestApplications/myApp.jar
which contains also folder
C:/myTestApplications/lib/images
Try that.

Exporting eclipse project to jar

I did check the already answeared questions which have almost the same topic as this question but none of the answeared onces were able to solve my problem.
I have been searching now online for about 4 hours and tried soo many different things to solve my problem..
Im trying to make a Pong game in Java and now i wanted to export my project so i can send it to some friend so he can try it.
Im using LWJGL for this project so i do have some jars added to the referenced libraries, And the LWJGL.jar has the windows natives added which is included in the projects lib folder.
Here is an image of the project viewer:
Reason im posting this image is so you get an idea of that i have all the libraries inside the project aswell as the natives needed for the project to run.
While reading about why the jar didnt work i also read that you need a Manifest.mf file so i created one and inside this manifest file i have the following text:
Manifest-Version: 1.0
Main-Class: jGame.Main
Class-Path: lib/jars/asm-debug-all.jar lib/jars/jinput.jar lib/jars/lwjgl.jar lib/jars/izma.jar lib/jars/slick.jar
Also 2 empty lines underneath Class-Path since i heard u have to have that.
This project runs fine aslong as i run it in eclipse but when i export the project with either runnable jar or jar wizard in eclipse it doesn't start when i double click the .jar file so i went into the cmd and used this command:
java.exe -jar JGame.jar
And the following message was shown:
I have checked atleast 10 times that i provided the correct path for the main class.. And i dont know what to do anymore. In the eclipse wizard i have been trying both to export runnable jar and exporting normal jar but none of the two is working. Also in the wizards i have selected to export a normal jar not runnable since when i choose runnable the libraries get messed up because the lib folder gets replaced.
I tried opening the jar file as an archive and got the following:
In an attempt of using JarSplice i suceeded to solve the problem.
After reading this:
It's not going to work the way you're trying to currently do it, since you need to have the native files along side the jar and point
to them via the '-Djava.library.path' parameter.
If you just want a single jar and want to avoid the hassle of the
command line and native files use the JarSplice tool. JarSplice is
easy to use and will automatically handle the native file stuff for
you.
1) Simply export your project (class and resources) to a jar (easier
just to do it through your IDE).
2) Then run JarSplice, add all the jars you need to the jars tab (your
app jar, lwjgl.jar, and any other external jar you're using).
3)Then on the natives tab add all the natives files (windows *.dll,
linux *.so, mac *.dylib & *.jnilib).
4)On the class tab add your main class. Then create your jar.
You can then run this jar just by double clicking it (or if you wish
via command line using 'java -jar yourapp.jar').
I found this solution from this link: Can't start .jar file (using LWJGL)
Reason why it didnt work the first time were i didn't include the actual .jar file that was exported from eclipse while using JarSplice.

java.lang.UnsatisfiedLinkError: no gluegen-rt in java.library.path

Trying to install JOGL for my Windows Eclipse installation and I'm picking up the error as described in the title.
This is what I did to try and install JOGL:
Downloaded jogamp-all-platforms.7z
Followed http://jogamp.org/wiki/index.php/Downloading_and_installing_JOGL for full installation using native libraries:
Made a new directory called jogl-2.0
Copied the shown .dll files to jogl-2.0\lib
Copied the shown .jar files to jogl-2.0\jar
Copied the shown .zip files to jogl-2.0\src
In Eclipse, went to Build Path => Add Libraries... => User Library
Created a new user library, set it to system library
Add the jars from External JARs
Add the dlls by specifying the libraries for each JAR
Add javadocs from URLs
Add sources from .zips
Yet it still reckons I haven't added the libraries in to complete the installation. I also added jogl-2.0\lib to my %PATH%, but that also did nothing.
Whilst typing this question, I found the solution!
Problem was checking the box for 'system library' in the 'Add Library' dialog. This needs to remain unchecked. If anyone can tell me why, I'll be grateful.
When I unset that, it was fine, but yelled because it couldn't find a couple more JAR files.
I added these JAR files to my jogl-2.0\jar directory and it worked:
gluegen-rt-natives-windows-amd64.jar
jogl-all-natives-windows-amd64.jar
I didn't need to do anything more within Eclipse.

Categories