In order to make the command double-clickable, you have two options.

The first is a bat file with exactly that string "java -jar application.jar" in it, which is double-clickable just like exe.

The second is to make an exe by compiling the following C program.

int main(){
    system("java -jar application.jar");
}
Answer from merlin2011 on Stack Overflow
🌐
SourceForge
launch4j.sourceforge.net
Launch4j - Cross-platform Java executable wrapper
Cross-platform Java executable wrapper for creating lightweight Windows native EXEs. Provides advanced JRE search, application startup configuration and better user experience.
Top answer
1 of 2
2

In order to make the command double-clickable, you have two options.

The first is a bat file with exactly that string "java -jar application.jar" in it, which is double-clickable just like exe.

The second is to make an exe by compiling the following C program.

int main(){
    system("java -jar application.jar");
}
2 of 2
1

I like to use 7zsd.sfx to create installers for my java applications.

Directions:
1.) install 7zsd.sfx from http://7zsfx.info/en/ and install 7z
2.) create a .7z archive
3.) add all the jre files required to run the java application to the archive
4.) add the application itself to the archive
5.) add a .bat or .exe file (for windows) to install the files after 7zsd.sfx extracts all the files
6.) add a .bat or .exe file to run the java application using the jre files
7.) create a file (preferably named "app.tag") with a structure such as that below (add your own parameters)

;!@Install@!UTF-8!
Title="My App"
BeginPrompt="Do you want to install My App?"
Progress="yes"
ExtractDialogText="Please wait while app files are being extracted..."
GUIFlags="32"
ExtractTitle="Installation"
FinishMessage="My app has been installed and added to your desktop."
RunProgram="setup.bat"
;!@InstallEnd@!

The RunProgram is the program that runs after the files are extracted to a temporary folder. This program should create a permanent folder to hold the necessary extracted files (jre, java application, and executable to run app with jre). Additionally, the program should create a nice, good-looking shortcut for the executable file used to run the app and it should move it to the desktop and add an icon.

Finally, to create the exe which will install your files, go to the command line and access the folder with 7zsd.sfx and type in the following command:

copy /b 7zSD.sfx + [pathToDirectory]\app.tag + [pathToDirectory]\yourAppArchive.7z [pathToDirectory]myExeInstaller.exe
Discussions

What are good exe wrappers/alternatives?
Java should just need JRE (the basic Java) to run as long as you compiled it already. IIRC windows also has the capability to open the .jar with JRE (as default) when clicked in explorer. You just need to right click -> open with -> set default. More on reddit.com
🌐 r/javahelp
18
8
February 14, 2020
Compiling a java program into an executable - Stack Overflow
It creates native Windows launchers (standard .exe) for your java applications. It makes java deployment much smoother and user-friendly, as it is able to find any installed Java VM by itself. When no VM is available, the wrapper can automatically download and install a suitable JVM, or simply ... More on stackoverflow.com
🌐 stackoverflow.com
Create Exe Wrapper/Installer for my Java App with a custom bundled JRE from Jlink
JavaFXs official packager tool javapackage makes OS specific native war appears around your java application. I think java 8 was the last release to officially support it. With java 9 we saw java modules and jlink start to appear and JavaFX starts to get moduled out into its own dependency. but it would take some time before javapackage gets a replacement. Java 14 saw an official replacement called jpackage. Its nice that it’s a core java tool instead of a javaFX specific tool. It’s far from perfect (incubator) and Im hoping it’s out of incubator by java 17 release. Here is a primer on jpackage https://www.baeldung.com/java14-jpackage and some more info https://openjdk.java.net/jeps/343 and here is another article discussing it when we saw an even earlier access in java 13 https://blogs.oracle.com/jtc/a-brief-example-using-the-early-access-jpackage-utility you need to create a jar, run jlink, then run jpackage. Don’t forget jpackage cannot build cross platform native launchers. And if your looking for the native launcher to also support auto updating the application and other fancy features you will need to look to third parties. My friend has been playing in this space for a bit I’ll ping them and see if they have anything to add Edit: there may be some insight here. https://github.com/agilhard-oss/jlink-jpackager-maven-plugin even if you don’t use the plugin the readme is informative. The readme suggests that for Windows Inno Setup or Wix is still required? Don’t know if it’s “required” for jpackage to build native packages or just “required” by that plugin. Edit 2: so ya the baeldung link helps confirm that for Windows you need Wix installed, for Mac you need Xcode installed, for Linux you need rpm-build installed. Or variations on those for exe or deb builds More on reddit.com
🌐 r/javahelp
13
15
August 13, 2020
java - How to pass a system property using Wrapper.exe - Stack Overflow
Update: You must start with additional.1 and count up without gaps (This is a convention for shoe-horning lists into Java properties syntax). ... Sign up to request clarification or add additional context in comments. ... Sounds good but doesn't work for me unfortunately. I tried: wrapper.java... More on stackoverflow.com
🌐 stackoverflow.com
🌐
GitHub
github.com › lordmulder › Launch5j
GitHub - lordmulder/Launch5j: Java JAR wrapper for creating Windows native executables · GitHub
For example: Assuming your application's JAR file is called thingamabob.jar, pick the Launch5j launcher variant of your choice (no wrapped variant though!), rename the launcher executable to thingamabob.exe, and put these two files into the “install” directory. Also, the Java runtime should be located in the runtime sub-directory within the “install” directory – unless you are using the registry variant of Launch5j.
Starred by 23 users
Forked by 5 users
Languages   C 50.2% | Makefile 23.3% | CSS 13.2% | Java 8.4% | Batchfile 4.9%
🌐
Reddit
reddit.com › r/javahelp › what are good exe wrappers/alternatives?
r/javahelp on Reddit: What are good exe wrappers/alternatives?
February 14, 2020 -

I am trying to figure out the best way to distribute a piece of software I have created in Java and .jar is not cutting it for me due to the fact you need to run it from command line. I don't know how to edit manifest files quite yet either. If that is simple then so be it I'll learn it, but an exe wrapper for Windows would be awesome to have.

Another question I have is what is required for people to run my Java program? Do they also need JDK? Do they need JRE installed (if so is this included in the basic Java install 90% of people have) ?

Sorry if this is a little lack luster.

EDIT: another problem has been posed to me: Made a .jar which included my lib folder (aka just for all my packages used) and it worked when I double clicked it and got super excited I went to show my friend. He transferred it to his computer and it’s default program to open was winRAR archiver (WTF) and so he could not run the .jar and rather just extracted files. Is there a fix or am I SOL?

Top answer
1 of 7
147

You can convert .jar file to .exe on these ways:

(source: viralpatel.net)

1- JSmooth .exe wrapper:
JSmooth is a Java Executable Wrapper. It creates native Windows launchers (standard .exe) for your java applications. It makes java deployment much smoother and user-friendly, as it is able to find any installed Java VM by itself. When no VM is available, the wrapper can automatically download and install a suitable JVM, or simply display a message or redirect the user to a web site.

JSmooth provides a variety of wrappers for your java application, each of them having their own behaviour: Choose your flavour!

Download: http://jsmooth.sourceforge.net/

2- JarToExe 1.8
Jar2Exe is a tool to convert jar files into exe files. Following are the main features as describe in their website:

  • Can generate “Console”, “Windows GUI”, “Windows Service” three types of exe files.
  • Generated exe files can add program icons and version information.
  • Generated exe files can encrypt and protect java programs, no temporary files will be generated when program runs.
  • Generated exe files provide system tray icon support.
  • Generated exe files provide record system event log support.
  • Generated windows service exe files are able to install/uninstall itself, and support service pause/continue.
  • New release of x64 version, can create 64 bits executives. (May 18, 2008)
  • Both wizard mode and command line mode supported. (May 18, 2008)

Download: http://www.brothersoft.com/jartoexe-75019.html

3- Executor
Package your Java application as a jar, and Executor will turn the jar into a Windows exe file, indistinguishable from a native application. Simply double-clicking the exe file will invoke the Java Runtime Environment and launch your application.

Download: http://mpowers.net/executor/

EDIT: The above link is broken, but here is the page (with working download) from the Internet Archive. http://web.archive.org/web/20090316092154/http://mpowers.net/executor/

4- Advanced Installer
Advanced Installer lets you create Windows MSI installs in minutes. This also has Windows Vista support and also helps to create MSI packages in other languages.
Download: http://www.advancedinstaller.com/ Let me know other tools that you have used to convert JAR to EXE.

2 of 7
41

I would use GCJ (GNU Compiler for Java) in your situation. It's an AOT (ahead of time) compiler for Java, much like GCC is for C. Instead of interpreting code, or generating intermediate java code to be run at a later time by the Java VM, it generates machine code.

GCJ is available on almost any Linux system through its respective package manager (if available). After installation, the GCJ compiler should be added to the path so that it can be invoked through the terminal. If you're using Windows, you can download and install GCJ through Cygwin or MinGW.

I would strongly recommend, however, that you rewrite your source for another language that is meant to be compiled, such as C++. Java is meant to be a portable, interpreted language. Compiling it to machine code is completely against what the language was developed for.

🌐
SourceForge
jsmooth.sourceforge.net
JSmooth - Java Executable Wrapper
Manual html, PDF, JNI · When no VM is available, the wrapper can automatically download and install a suitable JVM, or simply display a message or redirect the user to a web site
🌐
Mindprod
mindprod.com › jgloss › executablewrapper.html
executable wrapper : Java Glossary
Java Glossary · E words · executable wrapper · executable wrapper · A utility that takes a Java jar file and bundles in inside a Windows exe file to give the illusion the program in a C utility. It still needs a JVM (Java Virtual Machine) to work. It is not the same as a native compiler.
Find elsewhere
🌐
Tanuki Software
wrapper.tanukisoftware.com › doc › english › props-wrapperw.html
wrapperW.exe - Java Service Wrapper - Tanuki Software
wrapperW.exe provides a consoleless way of running your application wrapped by the Java Service Wrapper. The wrapperW.exe binary is a consoleless version of the wrapper.exe binary. It is designed to be used for desktop applications, etc., where you do not want a console to be visible to the user.
🌐
Tanuki Software
wrapper.tanukisoftware.com
Portada - Java Service Wrapper
Además de poder ejecutarse como un servicio de Windows o un demonio de Unix, el Wrapper reúne funciones avanzadas de monitoreo y detección de fallas, haciéndolo el conjunto de herramientas ideal para garantizar la máxima confiabilidad y tiempo de actividad para su aplicación Java.
🌐
MalwareTips
malwaretips.com › home › trojans › wrapper.exe: what is wrapper.exe? is wrapper.exe malware?
Wrapper.exe: What Is Wrapper.exe? Is Wrapper.exe Malware?
June 21, 2023 - Wrapper.exe is an executable file that can have different uses and origins. It can be part of legitimate software applications that run Java services, create GUIs, or provide 3D graphics features.
🌐
Reddit
reddit.com › r/javahelp › create exe wrapper/installer for my java app with a custom bundled jre from jlink
Create Exe Wrapper/Installer for my Java App with a custom bundled JRE from Jlink : r/javahelp
August 13, 2020 - So I'm migrating from javapackager to jpackage. Although I'm not using jlink, I hope it may help OP. Changeset on my /installer build scripts can be found in this (currently WIP) GitHub merge request. ... Not sure if is the best, but checkout InnoSetup. With this you can set where your jar will be installed and creates an exe pointing it.
🌐
SourceForge
sourceforge.net › projects › wrapper
Java Service Wrapper download | SourceForge.net
Download Java Service Wrapper for free. Configurable tool which allows Java applications to be installed and controlled like native NT or Unix services. Includes fault correction software to automatically restart crashed or frozen JVMs.
Rating: 5 ​ - ​ 7 votes
🌐
Real's HowTo
rgagnon.com › javadetails › java-0588.html
Launch a java program as a Windows EXE file - Real's Java How-to
It creates native Windows launchers (standard .exe) for your java applications. When no VM is available, the wrapper can automatically download and install a suitable JVM, or simply display a message or redirect the user to a web site.
🌐
BleepingComputer
bleepingcomputer.com › home › startup programs database › wrapper.exe information
MS Java Service Wrapper Windows NT & XP - wrapper.exe - Program Information
This entry has information about the Windows startup entry named MS Java Service Wrapper Windows NT & XP that points to the wrapper.exe file. Please visit this result for more detailed information about this program.
🌐
Tanuki Software
wrapper.tanukisoftware.com › doc › english › download.jsp
Download Java Service Wrapper - Java Service Wrapper
Please select the specific download for the platform and edition which meets your needs. All editions of the Wrapper can be downloaded freely. The Standard and Professional editions require that a valid license be present in the configuration file to run. The various licensing options are described ...
🌐
GitHub
github.com › BrunoReX › jsmooth
GitHub - BrunoReX/jsmooth: JSmooth is a Java Executable Wrapper that builds standard Windows executable binaries (.exe) that launch java applications. · GitHub
JSmooth is a Java Executable Wrapper that builds standard Windows executable binaries (.exe) that launch java applications. - BrunoReX/jsmooth
Starred by 8 users
Forked by 4 users
Languages   Java 50.4% | C 26.0% | C++ 23.5% | CSS 0.1%
🌐
Krenger
krenger.ch › blog › java-service-wrapper-3-5-43-for-windows-x64
Java Service Wrapper 3.5.43 for Windows x64 – Simon Krenger
The following package includes the sources, the build log and all binary files for the Tanuki Java Service Wrapper 3.5.43 for Windows x64. To run the wrapper, the following three files from the archive are needed: bin/wrapper.exe · lib/wrapper.dll · lib/wrapper.jar ·
🌐
Appnovation
appnovation.com › blog › run-java-applications-windows-services-java-service-wrapper
Run Java Applications as Windows Services - Java Service Wrapper | Appnovation
March 10, 2011 - But in summary, the main step is to edit wrapper.conf which is stored under the "conf" folder and these following configuration directives should be updated based on your environments and Java application. wrapper.java.command path to your java.exe wrapper.java.mainclass specifies the name of the class what will be instantiated by wrapper.exe.