Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to create executable jar file?

 
Vipul Gulhane
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can anybody tell me How to create executable jar file?
 
Darryl Burke
Bartender
Posts: 5148
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Packaging Programs in JAR Files
 
Vipul Gulhane
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

sir thanks for reply but i want to create executable jar file.
which is executable if the uesr dubble click on it.........
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
... which is what is described there.
 
Vipul Gulhane
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 85
Eclipse IDE Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In Ubuntu you have to make the Jar executable in order for it to be launched. Right click, permissions, enable execution. Hope that helps.
 
Vipul Gulhane
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 85
Eclipse IDE Mac Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic