Originally posted by: Gobadgrs
So where do I go on the web or elsewhere to get this program to do it?
Static native Java compilers are extremely unpopular. Not only do they fly in the face of the Java platform design, but in practice, they typically lag the current state of the art by years (not months). Furthermore, in testing, they have rarely lived up to claims of better performance. Nowadays, the relative gap between JIT'd Java and very mature C/C++ runtimes is estimated at roughly 2-3 times. Since static Java compilers are not nearly as well developed as C/C++ compilers and runtimes, there is little benefit from going this route.
In the past, TowerJ was a popular, expensive, commercial server-side static Java compiler. GNU's GCJ (part of GCC) is a fledgling open-source project with the best chance of reimplementing Java, but it's currently years behind Java2 1.4. I think the current commercial leader in static Java compilers is something from Excelsior, or something like that. But like I said, static Java compilers are a niche market that's becoming less relevant as time passes (and JVMs increasingly mature).
If your question just has to do with packaging and startup of a client app, then the two standard ways are:
- A shell script to call the JVM command. Java client apps can be packaged as JARs that specify the Main-Class as an attribute in the JAR manifest. This simplifies calling the JVM to java -jar MyApp.jar
- Java WebStart, a web-based client app bootstrapping technology that's relatively new.
A few vendors offer an ad-hoc technique of building a small .exe wrapper (typically on Windows platforms) that is essentially a native form of the shell script. A couple examples of IDEs that do this were already mentioned; I think Borland JBuilder also provides this facility. You could write the equivalent code in C in fewer than 100 lines of code using the invocation API if you really wanted to. But as mentioned, there's little benefit to this route. It requires extra maintenance, and the JVM would still have to be deployed for it to work. This .exe loader approach is completely different from the static compiler/runtime mentioned above.
Although somewhat primitive, the shell script is still the de facto standard bootstrap approach for the Java platform.