Logo 
Search:

Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

Make a exe file

  Asked By: Trupti    Date: Jul 06    Category: Java    Views: 1065
  

I have a question regarding how to make an exe file. I am one java
program. In order to run that i have to use following command
>javac Hello.java
>java Hello

But, I want to make an exe file so, use just click on it work. If
anyone one know that please let me know. I really appriciated your
help.

Share: 

 

6 Answers Found

 
Answer #1    Answered By: Clayton Richardson     Answered On: Jul 06

yeah here you go:

--- [ run_prog.c ] ---
#include <stdlib.h>

int main()
{
system("javac Hello.java");
system("java Hello");
return 0;
}
--- [ run_prog.c ] ---

 
Answer #2    Answered By: Adelinda Fischer     Answered On: Jul 06

I think this does not work  if you dont have the java file.
i.e you need the .java file  and the JVM whenever you run  the c code.
this can be a soln but not complete soln.

There are some utilities on the net. you can search in google.com
these utilities take the .class file and give you a .exe file.
once you get the .exe, you dont need the .java file or .class file to run the
program.

 
Answer #3    Answered By: Tamara Nguyen     Answered On: Jul 06

Does the system command you are using work  in dos prompt i mean turbo C compiler

 
Answer #4    Answered By: Ujala Hashmi     Answered On: Jul 06

this solution is no different to the tools on google.

The reply asked for the tool to compile the .java and run  the .class

You are all so narrow minded, just take the line out which compiles the
java.

You fail to see why java was written as it has been. If the java
community wanted .exe files they would make  it so. Java .class files are
not even machine code.

You can associate the .class/.jar files so that they are run by javaw,
just write a vb program that has a .exe which adds registry
associations, the next line in the vb should execute "MyJar.jar".

Desnt this list have a faq for this question? Ive seen it asked so many
times in the past month.

Sorry for poor language and tone, but this really frustrates me when I
keep reading "How can I convert my hello world to .exe so that windows
users can run it". Have a thought for all the other platforms which do
not support .exe/.com/.bat/.dll.

If you do not want other platforms to run java code then make word vb
macros. The philosophy of java is compile on one platform, run on all
others, keep that in mind.

Note, if i have not made it clear, .exe will only run on MSDOS. How
about an ELF?

 
Answer #5    Answered By: Robin Bailey     Answered On: Jul 06


That would do the work  but you would end up compiling the source everytime and
creating two extra processes when you run  it.

Using JNI to create the JVM and then executing your previously compiled class
is the way to go IMHO.

 
Answer #6    Answered By: Oscar Evans     Answered On: Jul 06

If you want you can use JBuilder 9

 
Didn't find what you were looking for? Find more on Make a exe file Or get search suggestion and latest updates.




Tagged: