• 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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

how to create exe file

 
Ranch Hand
Posts: 580
Eclipse IDE
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How to create a exe file from a jar file?
Actually i want my program to run just by double click.
 
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
An exe will tie you down to the windows platform.

A jar file can be made to launch the application by double clicking it.
Check this out for more details on creating a jar and especially the manifest file
http://java.sun.com/docs/books/tutorial/deployment/jar/
 
James Tharakan
Ranch Hand
Posts: 580
Eclipse IDE
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the link...
Now i am able to run the jar file in command prompt using the command "java -jar *.jar"
But when i double click on the *.jar file nothing is happening...
Whatis that i am missing??
 
Maneesh Godbole
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
[qoute]Now i am able to run the jar file in command prompt using the command "java -jar *.jar"

You cannot "run" a jar file that way.
It has to be something like java -jar JarFileName.jar
 
James Tharakan
Ranch Hand
Posts: 580
Eclipse IDE
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yeah... i mean to say
java -jar FileName.jar
is working...

But not able to run by double clicking
 
Maneesh Godbole
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What do you mean by "not able to run". Do you get any warning dialogs?
What is this application? Is it some GUI stuff?

When you run it using java -jar FileName.jar do you get any stack trace on the console?
 
James Tharakan
Ranch Hand
Posts: 580
Eclipse IDE
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Not a gui... the program prints a sequence of numbers.


It gives the output... A sequence of numbers.
 
Ranch Hand
Posts: 349
Hibernate Eclipse IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Anything special should be done to make jar to execute on double click!!??
 
James Tharakan
Ranch Hand
Posts: 580
Eclipse IDE
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ananth Chellathurai wrote:Anything special should be done to make jar to execute on double click!!??


Nothing... just dis play number
 
Maneesh Godbole
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok.
The jar file, on double click, is designed to run with javaw by default, which does not have a console window.

To change this, on windows, you can right click the jar file, select open with and choose java (instead of javaw)

Once you set this up, you can double click, and see the numbers on the console.
 
James Tharakan
Ranch Hand
Posts: 580
Eclipse IDE
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have two option
1-java platform SE binary
2-java web starter lancher

now ,When i double click it is giving a error saying
could not find main class : filename .program will exit
Is it error in the Manifest class ? ?
 
Maneesh Godbole
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please read my previous reply carefully.
Did you choose java.exe?
 
Marshal
Posts: 79153
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

James Tharakan wrote:I have two option
1-java platform SE binary
2-java web starter lancher

now ,When i double click it is giving a error saying
could not find main class : filename .program will exit
Is it error in the Manifest class ? ?

Don't know. What exactly have you got in the Manifest file? You need to use the exact format described here in the Java Tutorials, which Maneesh has already told you about. It might be easier to cheat and get an IDE to write the Manifest for you.
And there is another program you can use to launch the .jar namely javaw.

Try "javaw -jar MyJar.jar" in a batch file on Windows. See whether that works.
 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There are two free applications that let you create ".exe" from jar files. Also you can create installer as well.

These applications are :

Jsmooth
Lauch4J

You can google it for their webpages.
 
James Tharakan
Ranch Hand
Posts: 580
Eclipse IDE
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Maneesh Godbole wrote:Ok.

To change this, on windows, you can right click the jar file, select open with and choose java (instead of javaw)



Which file are you talking about???
jar.exe or myjar.jar
 
James Tharakan
Ranch Hand
Posts: 580
Eclipse IDE
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
 
Campbell Ritchie
Marshal
Posts: 79153
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

James Tharakan wrote:

Please look at this FAQ.

I presume it meant the .jar file, not jar.exe.
 
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You're asking a complex question that is not easily answered without actually being the developer who wants to "create exe file."
This is an EXCELLENT article that I consider required reading before you go any further:
http://www.excelsior-usa.com/articles/java-to-exe.html
 
reply
    Bookmark Topic Watch Topic
  • New Topic