How to create executable .exe file from .jar file? [duplicate] - java

This question already has answers here:
How can I convert my Java program to an .exe file?
(16 answers)
Closed 6 years ago.
I've created an app using netbeans IDE but it is in .jar format.How do I convert it into .exe to use on individual system ?

many responses here:
Compiling a java program into an executable
JSmooth .exe wrapper
JarToExe 1.8
Executor
Advanced Installer for Java - tutorial for Java applications
GCJ
Launch4J: http://launch4j.sourceforge.net/

If you need to just create a runnable file of your application, the JAR should be enough to do the job. You can export it as an executable jar with the manifest file and run it just by double cliking it.
Still if you require an exe, then you can use Launch4J. To create an exe, create jar file for your application using your IDE with proper MANIFEST file packaged inside. Then launch Launch4J and select your jar file and you should be able to create an exe easily.
For more details, take a look at this link here

You can use launch4j this can make jar an exe

Related

Reducing the size of a java project when exporting it to an ".exe"-Application [duplicate]

This question already has answers here:
How can I convert a .jar to an .exe?
(7 answers)
Closed 3 years ago.
I currently have to take care of a Java Project (JavaFX 8). The application is finished, but my boss wants an .exe file, to click on and run the thing.
I built the .exe app from the Java source code with IntelliJ IDEA, but the folder with all the .dll files is huge (the .exe itself is tiny). My question is, if someone has experience in reducing the size of the folder, or if there is a way to make a single small .exe file.
The folder structure looks like:
|> FOLDER "app" (jar and config file)
|> FOLDER "runtime" (very huge)
|>bin
|>lib
|>some .dll and the .exe
I understand the I somehow need the JRE with the .exe file but maybe there still is a way to reduce the size of the runtime folder since the app itself is "pretty tiny".
Thanks for your help.
If you need the JRE to be packed with it you can use
Excelsior JET
It is not free though.
If you just need to package your Jar with little overhead you can use
Launch4j
You need to supply your own JRE with it though.

Unable to create .exe from java file [duplicate]

This question already has answers here:
How can I convert my Java program to an .exe file?
(16 answers)
Closed 8 years ago.
I have created java project that contains 6 Class file and 1 java file
And I run this project in net beans IDE now my problem is when I clean and build this project am unable to create exe file
How can I make this project as exe (an executable file)?
all 7 files in one single as executable
and found this and tried from here making executable file from a java project using NetBeans Can some one help me to solve my problem
The JAR file format provides many benefits.
You can make your Java application runnable via a double-click by packaging it into an executable jar.
This answer will help you.

How can I make an executable file with java netbeans?

How can I make an executable file with Java using NetBeans IDE that file work on computer or mobile. I create jar file but I don't know why it did not work.
You can run jar file in case its manifest contains proper reference to class with main() function using command java -jar jarfile.jar. If you need Windows executable, you can use launch4j. For Android AFAIK you need to build apk file.

Wrapping JRE with my JAR in one EXE file [duplicate]

This question already has answers here:
Bundling the JRE with a Java application
(2 answers)
Closed 8 years ago.
I have read many threads in stackoverflow but I didn't get the answer.
I used JSmooth and Launch4j but what I want exactly is to get a final .exe file from my JAR application and a JRE so that my windows client won't need to install any JRE (in another way: to get a portable application with its own JVM)
I found that is not possible but why? Does that need the compilation fo the jre with my application source?
I hope my question is clear, any help will be appreciated.
Zip the JRE folder and include it as a resource in your .exe file.
At run time, you'll need to extract that resource to the disk, unzip it and then invoke it using ShellExecute to run your .jar file. The size of your executable will probably be quite huge.
This is your only viable solution.. Otherwise, if it is for windows only, why not just write the whole application in C++? Is there a reason why you need your JRE with the application? Why not let the user install their own JVM?

Command line tool to convert a jar to an executable? [duplicate]

This question already has answers here:
How can I convert a JAR file to an EXE file?
(9 answers)
Closed 10 years ago.
I can convert a Java .class file into a .jar file by the following command:
jar cvf Hello.jar Hello.class
Now I want to convert the .jar to a Windows executable (.exe).
Is there any similar command or any command line tool to do this?
I am developing an automatic tool to compile the .class file to an .exe without any human intervention so GUI-based tools will not work.
There are several options out there :
Jar2Exe
Excelsior JET
Executor
JSmooth
GCJ
JCGO
Launch4J
JexePack
The last one(JexePack) is maybe the more closer to your needs since it is a command line tool :
JexePack is a command line tool (great for automated scripting) that
allows you to package your Java application (class files), optionally
along with its resources (like GIF/JPG/TXT/etc), into a single
compressed 32-bit Windows EXE, which runs using Sun's Java Runtime
Environment. Both console and windowed applications are supported.
I've always used Launch4J. Easy to add to an Ant or shell script. There is a GUI to facilitate building the config file (if you need it), then reference the config file in the script.
Have a look at JSmooth. Bonus: There is also a maven plugin for it.
Update: To run as command line see the command line reference manual.

Categories