wood burning stoves*
The moose likes Beginning Java and the fly likes how to create exe file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "how to create exe file" Watch "how to create exe file" New topic
Author

how to create exe file

James Tharakan
Ranch Hand

Joined: Aug 29, 2008
Posts: 580

How to create a exe file from a jar file?
Actually i want my program to run just by double click.


SCJP 6
Why to worry about things in which we dont have control, Why to worry about things in which we have control ! !
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10175
    
    8

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/

[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
James Tharakan
Ranch Hand

Joined: Aug 29, 2008
Posts: 580

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
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10175
    
    8

[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

Joined: Aug 29, 2008
Posts: 580

Yeah... i mean to say
java -jar FileName.jar
is working...

But not able to run by double clicking
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10175
    
    8

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

Joined: Aug 29, 2008
Posts: 580

Not a gui... the program prints a sequence of numbers.


It gives the output... A sequence of numbers.
Ananth Chellathurai
Ranch Hand

Joined: Nov 21, 2007
Posts: 349

Anything special should be done to make jar to execute on double click!!??


Ananth Chellathurai [Walk on software]
James Tharakan
Ranch Hand

Joined: Aug 29, 2008
Posts: 580

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

Nothing... just dis play number
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10175
    
    8

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

Joined: Aug 29, 2008
Posts: 580

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
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10175
    
    8

Please read my previous reply carefully.
Did you choose java.exe?
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38108
    
  22
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.
mahesh kale
Greenhorn

Joined: Apr 02, 2008
Posts: 6
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

Joined: Aug 29, 2008
Posts: 580

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

Joined: Aug 29, 2008
Posts: 580

Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38108
    
  22
James Tharakan wrote:
Please look at this FAQ.

I presume it meant the .jar file, not jar.exe.
Joseph Macer
Ranch Hand

Joined: Apr 20, 2008
Posts: 63
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
 
 
subject: how to create exe file
 
Similar Threads
its urgent
How to create exe file
How to create an .exe file?
.exe file for Java Application
creating exe of java