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?
Related
This question already has answers here:
How can I convert my Java program to an .exe file?
(16 answers)
Closed 2 years ago.
So i just finished a small Java program that I've been working on throughout the week and I want to generate an .exe file of it so I can share with my friends. I'm working on Apache Netbeans 11.3 and JDK 8.
I can successfully generate the .jar file but that's pretty much useless.
If you created a java project, then the "other" computer should have the java runtime installed, in order for the jar to be executed there (java -jar your.jar) otherwise if you really want an .exe use one of the many jar2exe converters found on the almighty internet, such as ja2exe you can download it
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.
This question already has answers here:
How can I convert my Java program to an .exe file?
(16 answers)
Closed 3 years ago.
I have already a Java Project in Intellij.
I want to make a .exe Java file, but I did not find any solution yet for Java Projects. On the other hand, I have found many youtube videos in which they use a JavaFX Project to create an artifact which they will use to create a .exe file.
One of them is the following youtube video:
IntelliJ export JavaFX application to exe on Windows
My end goal is, that a user just double clicks on the file and a GUI opens. After entering some information the rest of the code should run. The file should be able to run to different windows systems, so this should not only work when installing special packages.
Did I chose the wrong type of project? To that I just read, that JavaFX will be discontinued.
I am confused in so many levels...
You should first make an executable .jar file and then use an .exe wrapper on the jar. I've used
Launch4j in the past with great success. I haven't tried it on javafx yet, but there are many executable wrappers to choose from with a quick google search. If this is at all unclear, leave a comment, and I'll detail these steps more. Launch4j has an almost self explanatory interface, so I don't think you should have trouble as long as you're sure your .jar launches.
What you're looking for is an executable jar file I think. I know that eclipse you can generate one so I'd assume you can do the same in intellij. How to
This question already has answers here:
Closed 12 years ago.
Possible Duplicate:
How can I convert my java program to an .exe file ?
I'd like to create a Windows .exe for a Java program. Previously, I've used JEXECreator for this, but it's not entirely satisfactory because:
The executable sometimes works on the machine on which it was created but not on others.
The program is commercial; if you use the trial version, it adds a nag screen to your application.
I don't need the generated .exe to work if Java is not installed on the target machine (in fact, I think this is impossible).
Any recommendations?
Launch4j perhaps? Can't say I've used it myself, but it sounds like what you're after.
Most of the programs that convert java applications to .exe files are just wrappers around the program, and the end user will still need the JRE installed to run it. As far as I know there aren't any converters that will make it a native executable from bytecode (There have been attempts, but if any turned out successful you would hear of them by now).
As for wrappers, the best ones i've used (as previously suggested) are:
JSmooth
and
Launch4j
best of luck!
If you really want an exe Excelsior JET is a professional level product that compiles to native code:
http://www.excelsior-usa.com/jet.html
You can also look at JSMooth:
http://jsmooth.sourceforge.net/
And if your application is compatible with its compatible with AWT/Apache classpath then GCJ compiles to native exe.
I used exe4j to package all java jars into one final .exe file, which user can use it as normal windows application.
You could try exe4j. This is effectively what we use through its cousin install4j.
The Java Service Wrapper might help you, depending on your requirements.
If Java is installed on the target machine, there is no need to create an .exe file. A .jar file should be sufficient.
This question already has answers here:
How to make an executable JAR file?
(5 answers)
Closed 8 years ago.
I wrote a JAVA program for my wife to compare coupons stacked with sales on different item sizes to save her time on her shopping-trip-planning. Now I need to put it on her computer in such a way that she can double-click something, and have the program run. I'm not finding anything good on the interwebs (like a decent step by step).
It is a simple program, one class with a nested class, and various imports of swing, awt, and text.
Since it's my wife's computer, I can make sure that she is running the appropriate JRE. Thanks in advance for any help.
You can use Launch4j application. That convert executable jar file to windows native executable application.
You can also embed JRE with it so if JRE is not installed on machine the application will run.
you can also add some other mechanism to it also like loading image, icon, etc.
I assume you are using Eclipse. In this website they given it very clearly for eclipse.
Create Executable files in eclipse
Export it to (or create a) executable Jar.
Most IDE's will do this (I think you have to dig around Eclipse a little) or take a look at Packaging Programs in JAR Files and Setting an Application's Entry Point if you want to do it by hand
Most GUI OS's will run the Jar via a double click.
You could also investigate generating a native executable wrapper, which will make the program "look" more familiar to the user, including launch4j or exe4j or Packaging a Java App for Distribution on a Mac depending on your target platform
Use NetBeans and simply 'Build' the jar file. This will produce an executable file within the 'dist' folder of your project.
Eclipse is the same however slightly more hidden.