This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes How to create executable jar file? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "How to create executable jar file?" Watch "How to create executable jar file?" New topic
Author

How to create executable jar file?

Vipul Gulhane
Greenhorn

Joined: Mar 28, 2011
Posts: 20
Can anybody tell me How to create executable jar file?
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4523
    
    5

Packaging Programs in JAR Files


luck, db
There are no new questions, but there may be new answers.
Vipul Gulhane
Greenhorn

Joined: Mar 28, 2011
Posts: 20

sir thanks for reply but i want to create executable jar file.
which is executable if the uesr dubble click on it.........
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41133
    
  45
... which is what is described there.


Ping & DNS - my free Android networking tools app
Vipul Gulhane
Greenhorn

Joined: Mar 28, 2011
Posts: 20
Ulf Dittmer wrote:... which is what is described there.


sir thanks for reply but i want to create executable jar file.
That jar file is executable if the uesr dubble click on it.........
Cory Hartford
Ranch Hand

Joined: May 16, 2011
Posts: 82

In Ubuntu you have to make the Jar executable in order for it to be launched. Right click, permissions, enable execution. Hope that helps.


‎"The greatest of all weaknesses is the fear of appearing weak." - JB Bossuet
Vipul Gulhane
Greenhorn

Joined: Mar 28, 2011
Posts: 20
Cory Hartford wrote:In Ubuntu you have to make the Jar executable in order for it to be launched. Right click, permissions, enable execution. Hope that helps.

And in XP /win7 what we have to do?
Cory Hartford
Ranch Hand

Joined: May 16, 2011
Posts: 82

You shouldn't have to do anything aside from double click. You have to make sure you have the Java runtime environment installed. Also verify that the the files extension is for sure a JAR. If you followed the directions in the above link it should walk you through the process.
rob hinds
Greenhorn

Joined: Sep 23, 2008
Posts: 3
have you followed the instructions here: http://download.oracle.com/javase/tutorial/deployment/jar/run.html (from the above link) - specifically adding the main class definition in the manifest?

After that, the jar can be executed using the following command:

java -jar jar-file-name


some OS will handle this on double click so you dont have to type this every time, but this is not guaranteed on every OS..

The other option is to create a bat/sh file that can be double clicked to launch the jar.
Vipul Gulhane
Greenhorn

Joined: Mar 28, 2011
Posts: 20
how to create a runnable JAR file of our 'Java Application'.
in eclipse select project->export->java->then select runnable JAR
will this create 'Java Application runnable JAR file...
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41133
    
  45
I'm at a loss to understand what you're looking for. Darryl pointed you to a writeup that contains the answer you're looking for. You seem to have overlooked that, so I pointed out that, yes, indeed, the answer is in there. I thought for sure you would now read it more carefully. Instead, you're repeating essentially the same question a third time; may be you can apply yourself a bit harder?

As to the Eclipse part: what happened when you tried?
 
 
subject: How to create executable jar file?
 
Similar Threads
Executable jar
Click and go
How to create Executable jar file.
Destop application
creating win exe file from java