Connecting Tech Pros Worldwide Forums | Help | Site Map

how to create .exe file in java

Newbie
 
Join Date: Oct 2009
Posts: 1
#1: Oct 18 '09
I was created a software using frame so i want to create a executable file for the software.please tell me how to craete a .exe file for the java software?

Dököll's Avatar
Moderator
 
Join Date: Nov 2006
Location: Upstate NY - US
Posts: 2,268
#2: 2 Weeks Ago

re: how to create .exe file in java


You will need a .WAR file for certain Windows Apps, .WAR or .EAR should do the trick most ofthe time for either that or Web Apps. Please forgive me I am not aware of .exe files for Java Apps.

Good luck!
Expert
 
Join Date: Nov 2007
Location: Germany
Posts: 294
#3: 2 Weeks Ago

re: how to create .exe file in java


The *.exe file is only machine language for dos/windows and can only run there. But Java runs on all operating systems, so it's using an intermediate code (which will be processed by the JVM and JIT). In the old days we used Symantec Visual Cafe to compile Java programs directly in machine language (.exe) or used MS Visual J++, but gladly these days are over, you don't need to do it anymore! JIT-compilers are so fast nowadays that portability is more important.

To distibute or run your java program as only one file, you don't need an *.exe. You can make a single *.jar file from all your classes.
So you can double-click the *.jar and it runs like an *.exe (if you have not modified the file associations, for example to open it with WinZip)!
To run it in this case, just create an icon (or a *.bat text file) with the command inside
Expand|Select|Wrap|Line Numbers
  1. java -jar myApp.jar
Or more precisely, and also if you do not like console window (you wrote that your program already has a frame):
Expand|Select|Wrap|Line Numbers
  1. C:\Programs\myJavaInstallationFolder\bin\javaw.exe -jar "C:\Programs\myAppFolder\myApp.jar"
Reply