Sign in to follow this  
Radiocreed

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

Recommended Posts

I managed to create JAVA exe with a program called 'Java Launcher'. The exe produced works fine on my computer and other computer science people's computer. When I run it on a computer virgin of any JAVA stuffs, it complains 'JDK not installed'. Any help please?

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
The JDK obviously needs to be installed on the target computers. No (reasonable) way around that...

Share this post


Link to post
Share on other sites
Java is a language that runs on a virtual machine. With the virtual machine to interpret it, the computer looks at the code and goes, "What the crap is this?"

Share this post


Link to post
Share on other sites
What it really requires is the Java Runtime Environment (JRE), not the Java Software Development Kit (SDK). You can however use the GCC Java Compiler, which you can find links to here. I personally haven't used it, but it could be what you're looking for.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Link? About what are you talking?

But if you really want something then

main: yourClassFileHere
dont forget enter at end of the line

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
Quote:
Original post by doodle_sketch
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?
I must admit I'm not a fan of wrappers either, so no, you're not the only one. :) I always thought executable JAR files did a fine job. Of course, if you want to have a custom icon associated with your program I think you might have to settle for a wrapper.

Share this post


Link to post
Share on other sites
I use wrappers when sending my java programs to people who need to see the 'ExpensiveProgram.exe'. By doing this I can save the hassel of having to retell every person who uses the program that it needs the JVM to run... They always look at you like they don't believe you. "Isn't it just a program?" they don't get that not all programs are exe files... On macs it is no problem because I can create app files, and then usually for people who run Linux or Solaris they know what the heck a dang JAR file is.

I find that wrappers help people to just RUN the program without having to call me up.

Share this post


Link to post
Share on other sites
Yes! That's the main benefit of it I would think. No need to have the JRE installed. The cost is that you'd have to "recompile" for every platform you want to run on. Any other downsides to it? It sounds interesting, will have to try it sometime.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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++

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this