wood burning stoves
The moose likes Swing / AWT / SWT and the fly likes Convert .class to .exe Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Convert .class to .exe" Watch "Convert .class to .exe" New topic

Convert .class to .exe

Dominic Steng�rd
Ranch Hand

Joined: Feb 05, 2001
Posts: 186
I need to convert an application(.class) into an executable file(.exe). My main problem is that the application uses Swing components, and it has to be able to run on Win 98 and upwards. So my question is how I can make sure that the application will be executable on these platforms even though it uses Swing? Will there be any problems? Will I have to convert the application so it uses AWT components instead?

Dominic Steng�rd<br />Sun Certified Java 2 Programmer
Matthew Jones
Ranch Hand

Joined: Dec 21, 2000
Posts: 68
Why would you need to convert Java class files to and .exe file? Why don't you just incluce the JVM when you distribute your app, and keep it a Java app, that way it can be used on any platform, if you decide later you need to be able to run it on other kinds of compuers.
Cindy Glass
"The Hood"

Joined: Sep 29, 2000
Posts: 8521
JtoEXE is available at this site:

"JavaRanch, where the deer and the Certified play" - David O'Meara
Grant Crofton
Ranch Hand

Joined: Nov 08, 2000
Posts: 154
J2EXE isn't a compiler, though, is it - it's like a launcher - it provides an executable to launch your app, but the class files are still in there in their original form.
Not that that really matters, I suppose.
GNU are working on a Java compiler that is freely available, I'm not sure what stage it's at yet.
I hear some commercial packages let you compile java to native executable, but i haven't looked into that.
Cindy Glass
"The Hood"

Joined: Sep 29, 2000
Posts: 8521
If you bundle the JRE in with your application it will include the swing stuff.
This explains how to use it http://java.sun.com/products/jdk/1.1.7B/jre/example/index.html
Cody Allcorn

Joined: Mar 21, 2003
Posts: 1
i need to do the opposite make a application into a java applet who can help?(.class)
Alexi Jordanov

Joined: Sep 19, 2003
Posts: 1
Try this one:
Jan Michael Soan
Ranch Hand

Joined: Feb 08, 2003
Posts: 36
1st of all if you want to create an executable format on a .java program what you need to do is to create a " .jar file " an executable form of java. Here's a guide where you can learn how to create a executable file or jar file.

If you still dont know how too then :

Try this for your program create 1st a manifest.tmp file in the notpad of your windows try typing this on you tmp file:
" main-class : yourmain.class "
After you figure out what java program you want to create a .exe for
then type this to the command promt :
c:\jdk1.3.1\javac\bin\jar Filename.jar manifest.tmp *.class
then press enter.
thats it you've just created a jar file.
Filename.jar here is the main java program that you put in the manifest file and also the one that you want to create an .exe for.
After finishing the .exe or the .jar file you can create an installer now, you need 1st to download the InstallAnywhere from http://www.zerog.com
Hope that helps . . .
Life is like a book that you need to review for continues knowledge and growth.
My Personal Site
[ September 19, 2003: Message edited by: Jan Michael Soan ]
I agree. Here's the link: http://aspose.com/file-tools
subject: Convert .class to .exe
It's not a secret anymore!