2

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.

BryanH
  • 5,826
  • 3
  • 34
  • 47
Santhosh Balasa
  • 186
  • 3
  • 11

3 Answers3

5

There are several options out there :

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.

aleroot
  • 71,077
  • 30
  • 176
  • 213
0

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.

Καrτhικ
  • 3,833
  • 2
  • 29
  • 42
0

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.

martinez314
  • 12,162
  • 5
  • 36
  • 63