Build Project? Executable file

Hi Everyone,

I am a student and have been programming in Java for the past 3 months. I was wondering if there is a way to make an executable from my java files. I have the source code, I compile it, and I can run it from the IDE (I use jCreator). If I want to send a non-source file to someone, so they can run the program, is there a way? I believe in C++, I can make my project into an executable file.

Please advice. Thanks for the answer!

[461 byte] By [@JavaNewbiea] at [2007-11-26 23:56:22]
# 1

The best and easiest thing is to create an executable jar file. You can probably create one using JCreator. An executable jar file is a file that contains your compiled code and data, plus some metadata, and when downloaded onto your desktop, you can double-click it and it will run your program, assuming that you have Java installed on that machine, which is reasonably likely.

You can also create native executables, but that's a pain for a variety of reasons. But if you really want to, you can do it. There's a company called Excelsior that makes a native compiler called Jet that costs like a thousand bucks.

paulcwa at 2007-7-11 15:41:29 > top of Java-index,Java Essentials,New To Java...
# 2

The equivalent to an EXE file in Java is an executable JAR.

Tutorial: http://java.sun.com/docs/books/tutorial/deployment/jar/index.html

I don't know about JCreator, but most IDEs will hold your hand and help you

export your project as an executable JAR. The tutorial shows making a JAR

by hand is not hard, anyway.

DrLaszloJamfa at 2007-7-11 15:41:29 > top of Java-index,Java Essentials,New To Java...
# 3
Thanks paulcw and DrLaszloJamF. This is exactly what I was looking for.
@JavaNewbiea at 2007-7-11 15:41:29 > top of Java-index,Java Essentials,New To Java...