Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I convert a JAR file to an EXE file?

Tags:

I want to created a JAR file and I want to run it on a client machine.So, I have a couple of questions:

  1. How can I convert the JAR file to an EXE file?
  2. How can I encrypt the JAR file's contents? The jar file could be extracted with WinRAR and the classes could be decompiled with any Java decompiler.
  3. How can I create an installer? My clients doesn't have any JVM and I don't want to ship JDK or JRE along, because they have big size.
like image 278
Freeman Avatar asked Feb 16 '10 10:02

Freeman


People also ask

Can we convert Java to exe?

The Java Packager tool compiles, packages, and prepares Java and JavaFX applications for distribution. The javapackager command is the command-line version. The javapackager utility ships with the JDK. It can generate .exe files with the -native exe flag, among many other things.

Is .jar and .exe same?

An Exe file is an executable file that can be executed in Microsoft OS environment. Jar file is container of Java Class files, including other resources related to the project. Jar file can be executed only if Java run time environment.


2 Answers

  1. See this link: Java to Exe. It also explains what valid reasons are to do this, and when you should not.

  2. You can't really encrypt binaries as the machine has to understand them. That said, an optimized executable is very difficult to decompile, while plain class files are ease.

  3. If you have an exe there are installers enough.

like image 105
extraneon Avatar answered Sep 22 '22 15:09

extraneon


JSmooth is a application which will wrap your Jar in an exe

it also allows you to check if the correct version of JRE is available on the system you're deploying to

http://jsmooth.sourceforge.net/

like image 29
Ganesh Shankar Avatar answered Sep 22 '22 15:09

Ganesh Shankar