This question already has answers here:
How to make a runnable jar file?
(4 answers)
Closed 7 years ago.
I'm trying to make runnable jar file of my java application. Each time I follow the steps of exporting application etc. It created a jar file for my application but when I run it, it shows popup 'java virtual machine. A java Exception has occurred'.
How can I resolve the issue?
This is correct, JAR IS a ZIP
JAR files are fundamental archive files, built on the ZIP file format and have the .jar file extension
Just run it!
Related
This question already has answers here:
How can I convert my Java program to an .exe file?
(16 answers)
How do I create executable Java program? [duplicate]
(11 answers)
Closed 3 years ago.
In Linux world one can just add shebang to the jar file and create an executable, it's widely disputed though whether this is a good practice or not. My question would be - is there something similar I can add to make the jar executable both on Windows and *nix platforms?
If you have a MainClass in the jar file's manifest file and you have Java installed on your system (i.e. Java is associated with the .jar file type), then the default Java installation should be used to execute this jar.
See How do I create executable Java program?
This question already has answers here:
Eclipse exported Runnable JAR not showing images
(8 answers)
Closed 7 years ago.
I'm trying to export my java file as a runnable .jar file using Eclipse. The procedure I'm doing is:
File > Export > Java > Runnable .jar, and my options are as follows:
http://gyazo.com/88ad22e9382e964e47a1a21200ff0f4b
My problem is, when I run the file in Eclipse, any imported pictures (e.g. a logo for the GUI application) shows up, but it doesn't show up in the exported .jar file.
I.e:
http://gyazo.com/4092e8756f4054ce00429d50c33c22af - in Eclipse
http://gyazo.com/7309d84f64832b22560ef023c9349a52 - running the .jar file
My images are in a folder called filesrc which is in the same folder as my project, as can be shown here:
http://gyazo.com/20f8191ee173e06638811c237f985c6f
What am I doing wrong? How can I make these images appear in the .jar?
Thanks
Make sure your exported .jar file contains the folder with your images. So lets assume that your images are in a folder called \images at the root of your JAR file.
In your code, you need to change the way your are getting these images to :
Toolkit.getDefaultToolkit().getImage(getClass().getResource("/images/plus.png"));
This question already has answers here:
How to create a Jar file in Netbeans
(4 answers)
Closed 9 years ago.
I created a java project using netbeansIDE. Now I want to convert it into an .exe file, but I need to convert the java project into a .jar file first, since java project can't be compiled into a .exe file directly it can be only be converted to exe from jar file. So how shall I convert java project into a .jar file. Please answer in detail since I am a beginer in java programing.
Thank You.
If you are using Netbeans IDE then you can easily build a jar file of your project.
Just go to Run in the Menu above and select clean and build.
Now goto to you project folder, find Dist folder inside it and there you have your .jar file.
This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
How can I convert my Java program to an .exe file?
I have Java project and will making a setup file to my project. İn my procet I have a jar file which runs my project. whan can I do to create a setup file to my Netbeans Java Project
There are software convert from jar to exe like JAR2EXE but it's not setup file
Check out Launch4J which will create an Windows executable from a Java JAR file.
This question already has answers here:
How to make a JAR file that includes DLL files?
(2 answers)
Closed 9 years ago.
I have a third party library that comes with .dll files that I need in order to run my java jar file. How can I include them in my jar file when I deploy my application? (I am using JSmooth to create an exe file - if that helps anything)
NOTE: I have looked at this stackoverflow question, but there's only one answer there, and I don't think it will work for me.
Thanks so much!
this has come up before. the short answer is that you cant - the dll has to be accessible to the underline OS and so cannot be inside the jar.
it can, however, be unpacked from within the jar to somewhere in the PATH before you call loadLobrary ....
look here : How to make a JAR file that includes DLL files?