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

Freeman picture Freeman · Feb 16, 2010 · Viewed 86.2k times · Source

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.

Answer

extraneon picture extraneon · Feb 16, 2010
  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.