[java] How do i create a standalone java exe?

Started by
12 comments, last by trevaaar 19 years, 2 months ago
Look into webstart and the sun-provided auto-install page for java.

Sun employs a bunch of fuckwitted executive morons, so they have failed to connect the above two items together, but you can easily provide a link on a webpage that will automatically determine the java version and platform and download and install it.

Just write "if this link (jnlp) doesn't do anything, then click here (sun's autodl) to upgrade your java, and then try again"

Works every time.
Advertisement
Quote:What is GCJ?
GCJ is a portable, optimizing, ahead-of-time compiler for the Java Programming Language. It can compile:

Java source code directly to native machine code,
Java source code to Java bytecode (class files),
and Java bytecode to native machine code.
Compiled applications are linked with the GCJ runtime, libgcj, which provides the core class libraries, a garbage collector, and a bytecode interpreter. libgcj can dynamically load and interpret class files, resulting in mixed compiled/interpreted applications.

Most of the APIs specified by "The Java Class Libraries" Second Edition and the "Java 2 Platform supplement" are supported, including collections, networking, reflection, and serialization.

**AWT is currently unsupported, but work to implement it is in progress.**

Ack!

more direct link here.
Quote:Original post by doodle_sketch
Quote:Original post by Talroth
Is there an easy way to link the class files, and create a 'shortcut' the the JVM stuff? I've never actually ran any of my programs outside my IDE, or as an applet.


Not entirely sure what you mean, but I think that executable Jar files might be what you're looking for...

BTW: Am I the only one who doesn't like the idea of native executable wrappers for Java? It kinda defeats the purpose of its cross-platform capabilities, doesn't it?



Wow, I have to stop posting while tired.

I was just talking about how can you take all your files in java and put them into one little file, like a .exe file from C++
Old Username: Talroth
If your signature on a web forum takes up more space than your average post, then you are doing things wrong.
To put all your classes into one file, use a JAR (a ZIP file with a "manifest" and a different extension, that can be created using the jar command). Create a manifest file, add a main class attribute to it (can't quite remember how to do that, google for it or look at somebody else's) and then jar everything. If the user has the JRE installed and hasn't got something like WinRAR stealing the .jar extension association, opening the JAR will run the program.

This topic is closed to new replies.

Advertisement