Skip to main content
gamedev.net
🔒 Locked

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

Started by Radiocreed 12 replies 3k views
Original Post
Radiocreed
Radiocreed
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?
okonomiyaki
okonomiyaki
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?"
Gorax
Gorax
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.
Luckless
Luckless
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.
Old Username: Talroth
If your signature on a web forum takes up more space than your average post, then you are doing things wrong.
Raghar
Raghar
Link? About what are you talking?

But if you really want something then

main: yourClassFileHere
dont forget enter at end of the line
aidan_walsh
aidan_walsh
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?
www.aidanwalsh(.net)(.info)
TheBluMage
TheBluMage
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.
H_o_p_s
H_o_p_s
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.
BRING BACK THE BLACK (or at least something darker)
tebriel
tebriel
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.
Luckless
Luckless
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.
trevaaar
trevaaar
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.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.