Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

exe

Hi everyone
I was wondering if I can get some help here. I have a Java application that I wrote using JCreator. It has a void Main in it so it is a standalone application(I think..). I was wondering how to create an .exe for the application. So that I wouldn't have to go into JCreator and compile it everytime I want to run it. There must be a way.

Richard
[383 byte] By [airrazor] at [2007-11-11 6:48:14]
# 1 Re: exe
Usually, Java programs are not directly executable from the operating system. They are run by invoking the Java Virtual Machine appropriate for your operating system/hardware combination which interprets the .class file(s) which is the bytecode instructions for the JVM [bytecode interpreted by JVM results in statements executed/interpreted by the level of the hardware above the CPU level]. Therefore you "run" a Java program by using the command "java XXXX [and any command line arguments]" where XXX is the name of the .class file which contains the method main for the program. Once a class file is compiled, you should not need to re-compile it (unless you've made a change to the source .java file) - just invoke the JVM.

There are programs you can obtain which will make object files of class files and other resources and then link them into an exe. Do a search for "java compile exe" and you'll find them.
nspils at 2007-11-11 22:40:20 >
# 2 Re: exe
I'm a beginner too.
you can use some IDe programm to solve this problem.
for example Jbuider
It can complie the java programm to an exe file
yaoger at 2007-11-11 22:41:20 >
# 3 Re: exe
help each other
yaoger at 2007-11-11 22:42:13 >
# 4 Re: exe
Take a look at this article. It enumerates all ways to generate .exe from Java, and it shows benefits and shortcomings of the each way.

http://www.excelsior-usa.com/articles/java-to-exe.html

Denis.

------
The most compilcated way to make .exe from Java is this:
http://www.excelsior-usa.com/jet.html
htayod at 2007-11-11 22:43:19 >
# 5 Re: exe
Thanks everyone.

nspills wrote: invoke the jvm

Do you mean java XXXX? If not how?
airrazor at 2007-11-11 22:44:23 >
# 6 Re: exe
Yes. If your class is MyClass, then at the command line type "java MyClass".
nspils at 2007-11-11 22:45:22 >
# 7 Re: exe
htayod.
Thanks for your help. I read over the article but I am still not 100% clear on how to create a jar file. Would you be able to go over the steps in a way that is easier to understand and follow. I know its a lot of work for you but if you don't mind...
airrazor at 2007-11-11 22:46:19 >
# 8 Re: exe
Google for "executable jar tutorial", there's pleny of tutorials available.

these are the first I found:

http://csdl.ics.hawaii.edu/~johnson/613f99/modules/04/jar-files.html

http://www.cs.princeton.edu/introcs/85application/jar/jar.html

Denis.
htayod at 2007-11-11 22:47:22 >