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?
            Asked
            
        
        
            Active
            
        
            Viewed 1.1k times
        
    7
            
            
        - 
                    1Generating exe-files from java-code is inherently a bad idea. You first loose platform idependence, and secondly, compiler-optimization might not be performed for the target machine as well as JIT-optimization will not get you, and updates for the jvm/api will not affect your code. – user unknown Feb 04 '11 at 08:15
1 Answers
12
            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
        
- 398,270
- 210
- 566
- 880
