aspose file tools
The moose likes Performance and the fly likes how to create .exe in java Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » Performance
Reply Bookmark "how to create .exe in java" Watch "how to create .exe in java" New topic
Author

how to create .exe in java

narasimharao konjeti
Ranch Hand

Joined: Apr 26, 2003
Posts: 130
please let me know how to create .exe file in java.
thanks in advance.
regards
nr konjeti


"Unwise to sweat petty stuff, wise to pet sweaty stuff."
David Weitzman
Ranch Hand

Joined: Jul 27, 2001
Posts: 1365
Two of the most obvious options would be GCJ and Excelsior JET.
But before you go too far, what's are your particular reasons for wanting an .exe? The proper course of action will be different depending on whether you want maximum performance, easy distribution to users, extra saftey from decompling, etc.
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8876

Can an application containing SWING be converted into .exe


Groovy
Stefan Wagner
Ranch Hand

Joined: Jun 02, 2003
Posts: 1923

Originally posted by narasimharao konjeti:
[QB]please let me know how to create .exe file in java.
BufferedWriter bw = new BufferedWriter ( new FileWriter (".exe"));
bw.write ("fooMZbar");
bw.close ();
Something like this would be exe file IN java.
(Did you know that exe-files are for lamers?)
WITH java, there are no exe-files (except java.exe, of course, for DOS-XP, -ME, -2K, ...).
First you'll have to create class-Files.
Do you know how this works?


http://home.arcor.de/hirnstrom/bewerbung
Peter Chase
Ranch Hand

Joined: Oct 30, 2001
Posts: 1970
Originally posted by narasimharao konjeti:
please let me know how to create .exe file in java.

Another respondent has suggested some third-party packages to make this easy. However, there is no need to use such things, if you can write 'C'.
The Java Invocation API allows you to fire up a JVM from within a 'C' program. Your 'C' program can just be a very simple program whose sole task is to start up your Java application.
A 'C' program can be compiled and linked to a native executable. On Windows, that means a *.EXE file, which is what you want.
You need an appropriate 'C' compilation environment for each platform, but other than this it is fairly platform independent (not as good as Java, of course).
I see that this post is in the "Performance" forum, so I wonder if the reason for converting to EXE is for performance. If so, note that using Invocation API will not improve (or reduce) performance.
There are tools that claim to convert Java byte code to native machine code. One reason for doing this is performance. However, the HotSpot JVM is very good nowadays and the performance improvement will be small, if it happens at all.
It is unlikely that there are more than a very few parts of your code that actually affect the perceived performance. Rather than convert the whole application to native machine code, it is much more sensible to identify these areas and to concentrate on improving their performance. Writing better Java will often improve the performance enough. If not, then just those small areas of the code can be replaced by native code, using the .Java Native Interface
[ August 06, 2003: Message edited by: Peter Chase ]

Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.<br /> <br />#:^P
Peter Chase
Ranch Hand

Joined: Oct 30, 2001
Posts: 1970
Originally posted by Pradeep Bhat:
Can an application containing SWING be converted into .exe

Yes. No problem. I have done it (Windows, Linux, Mac OS X, Unix). See my earlier post for one way of creating the EXE.
netharam ram
Ranch Hand

Joined: Aug 09, 2001
Posts: 202
Hi narasim I think u r looking for a simple tool that will convert u'r java class file into an exe , so that u can run that easily. I have a simple tool for u jexepack.
http://www.duckware.com/jexepack/index.html
As far as I know the basic idea behind this is they code the entire java file in 'C' & then compile it into an exe file. Try this out & reply if this does not help u out, for I have some other options too.
Think in the way, Others Don't
Netharam
[ August 07, 2003: Message edited by: netharam ram ]
Dana Hanna
Ranch Hand

Joined: Feb 28, 2003
Posts: 227
I think the best question is - Why EXE? After installing the newer versions of Sun's JRE, on most machines, JAR files can be double clicked. If this is all that you are looking for, just package your application in a JAR file, and create a manifest file to state where your main class is. Details can be found on the Sun site (sorry no link).
Originally posted by Stefan Wagner:
Originally posted by narasimharao konjeti:
[QB]please let me know how to create .exe file in java.
BufferedWriter bw = new BufferedWriter ( new FileWriter (".exe"));
bw.write ("fooMZbar");
bw.close ();
Something like this would be exe file IN java.
(Did you know that exe-files are for lamers?)
WITH java, there are no exe-files (except java.exe, of course, for DOS-XP, -ME, -2K, ...).
First you'll have to create class-Files.
Do you know how this works?

Huh? Why are you getting your panties in a tangle?
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: how to create .exe in java
 
Similar Threads
how to create exe file for java application
java
.exe file for Java Application
Doubt Pls Help me
creating exe of java