• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

how to create .exe in java

 
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
please let me know how to create .exe file in java.
thanks in advance.
regards
nr konjeti
 
Ranch Hand
Posts: 1365
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 8946
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can an application containing SWING be converted into .exe
 
Ranch Hand
Posts: 1923
Scala Postgres Database Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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?

 
Ranch Hand
Posts: 1970
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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 ]
 
Peter Chase
Ranch Hand
Posts: 1970
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
Ranch Hand
Posts: 202
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Ranch Hand
Posts: 227
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?

 
reply
    Bookmark Topic Watch Topic
  • New Topic