This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Is there a way to get a stand alone executable? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Is there a way to get a stand alone executable?" Watch "Is there a way to get a stand alone executable?" New topic

Is there a way to get a stand alone executable?

Lazaros Lazarou

Joined: Feb 13, 2001
Posts: 2
I was wondering if anybody knows how can i get a stand alone executable file for an application that i write. Is there a compiler that can do that for me? where could i get one and how much is it going to cost?
Thanks in advance
Scott Pedigo

Joined: Feb 15, 2001
Posts: 15
Netscape 6 and StarOffice were written in Java - you can tell from the look-and-feel and how slow they run. But they look like regular applications, so they must have a build-in JVM, which is what you need. Since Netscape 6 is based on an open source project, you might be able to get some information on how to do this by tracking that down.
Nathan Pruett

Joined: Oct 18, 2000
Posts: 4121

The only free way to create an executable from Java code is via GCJ, provided by Gnu( ) which translates your Java code to C++ which is then run through the GCC compiler. I believe this is for Unix based systems only... Several IDEs (I believe IBMs VisualAge, and I have heard Visual Cafe) support some kind of native code generation which consists of packaging a small JVM, your class files, and some kind of code to make the JVM execute them all together into an executable file. I think J++ (gag!) also supported native code compilation, probably through Visual C++, so your code could become more platform dependant than it already was...
Anyway, as far as native compilation goes, think about it long and hard before you do it... one of the major reasons to write a program in Java is the "Write once, run anywhere" philosophy, and native code compilation destroys this...

Write once, run anywhere, because there's nowhere to hide! - /. A.C.
Cindy Glass
"The Hood"

Joined: Sep 29, 2000
Posts: 8521
Let's back up a moment here. WHY do you want it to be an executable?? There are several ways to invoke java applications without converting them to exe's.
Howeveer, for creating an installation executable I hear that InstallSheild is quite good

"JavaRanch, where the deer and the Certified play" - David O'Meara
Neeraj Vasudeva

Joined: Feb 07, 2001
Posts: 12
Can i do create java exe from the software availble at ?
Neeraj Vasudeva
Come to my site... & explore the things..i am a new bie in java.

Come to my site... & explore the things..i am a new bie in java.
Cindy Glass
"The Hood"

Joined: Sep 29, 2000
Posts: 8521
Well, I still don't know WHY you are trying to make an exe however:
InstallSheild creates an executable out of your application so that you can point at it from a web page and the user can download it and it will install the application on his machine.
JToEXE creates an exe to kick off the application, although the class files are still used.
javaw invokes an application without the DOS window (which seems to be why some people are trying to create exe's). javaw comes with the SDK and JRE.
Matt DeLacey
Ranch Hand

Joined: Oct 12, 2000
Posts: 318
Seems like one reason WHY (or the my reason anyway), is if you want to write an app, distribute it, and not assume that everyone has a JVM on their box. I have heard about making a .jar and modifying the Manifest file, but do you have to include the jvm and the jre in the jar? Is that kosher with Sun? Do you need to include anything else in the .jar if you are assuming the user has no Java stuff on their machine?

With Respect,
Dirk Schreckmann

Joined: Dec 10, 2001
Posts: 7023
If the user doesn't have a JVM installed, the user's system won't know what to do with a jar file.

[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
I agree. Here's the link:
subject: Is there a way to get a stand alone executable?
It's not a secret anymore!