views:

1148

answers:

3

What compiler (I'm using gcj 4.x) options should I use to generate an "exe" file for my java application to run in windows?

A: 

Here is an in length discussion about the topic. It includes discussion about different compilers and IDEs.

Niyaz
+5  A: 

To compile the Java program MyJavaProg.java, type:

gcj -c -g -O MyJavaProg.java

To link it, use the command:

gcj --main=MyJavaProg -o MyJavaProg MyJavaProg.o

and then linking to create an executable mycxxprog.exe

g++ -o mycxxprog.exe mycxxprog.o
Bill the Lizard
A: 

So here it is for one class file this is good example, but if try to make my project how to follow the things to make my java project as the exe, I can create archive for all my classes(jar format) even though i am getting into multiple jar files