File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

jar file not working

 
linus dale
Ranch Hand
Posts: 44
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

when i double click a jar file that I created,I get this message


An error occurred while launching/running the application.

Category: Launch File Error

The following required field is missing from the launch file: <jnlp>

it opens from command prompt ,but not on double click
please help
thanks
 
Prashant Hurria
Ranch Hand
Posts: 40
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maybe You have the Path and Java Home set in the Commnd prompt but not on the Windows Settings so thats why the error.
Include Java_Home/bin in the Path variable and set Java_home. Will do the trick.
 
Campbell Ritchie
Sheriff
Pie
Posts: 47253
52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
More likely you need to associate the file with java.exe. I can't remember how to do it, but on Windows you can set "file associations" that files with extension .xyz open with abdce.exe.
 
linus dale
Ranch Hand
Posts: 44
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
no, that doesn't seem to work
 
Campbell Ritchie
Sheriff
Pie
Posts: 47253
52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Anybody else know? I don't. Sorry
 
Maneesh Godbole
Saloon Keeper
Posts: 10971
11
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Something funny happening here. JNLP file is usually used for JWS. You mention you are double clicking, i.e. the jar file exists on your file system.
1) Can you post the contents of the manifest file (inside the jar)?
2) Also, can you try invoking the jar from the command line (java -jar JarFileName,jar) and provide us the full stack trace?
 
linus dale
Ranch Hand
Posts: 44
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maneesh Godbole wrote:Something funny happening here. JNLP file is usually used for JWS. You mention you are double clicking, i.e. the jar file exists on your file system.
1) Can you post the contents of the manifest file (inside the jar)?
2) Also, can you try invoking the jar from the command line (java -jar JarFileName,jar) and provide us the full stack trace?



manifest.txt file is
Main-Class: HelloWorld

from the command line
java -jar JarFileName.jar
the jar file opens and gives the required output
 
linus dale
Ranch Hand
Posts: 44
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maneesh Godbole wrote:Something funny happening here. JNLP file is usually used for JWS. You mention you are double clicking, i.e. the jar file exists on your file system.
1) Can you post the contents of the manifest file (inside the jar)?
2) Also, can you try invoking the jar from the command line (java -jar JarFileName,jar) and provide us the full stack trace?



for another program with 2 classes the jar file doesn't form at all
it is in a different folder jar1

manifest.txt contains
Main-Class: TestII


on doing
jar -cvmf manifest.txt app5.jar *.class
I get

java.io.FileNotFoundException: manifest.txt (The system cannot find the file spe
cified)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:106)
at java.io.FileInputStream.<init>(FileInputStream.java:66)
at sun.tools.jar.Main.run(Main.java:122)
at sun.tools.jar.Main.main(Main.java:903)
program



please help
thanks
 
Maneesh Godbole
Saloon Keeper
Posts: 10971
11
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It should be manifest.mf.
What you have posted indicates what happens when you build the jar, whereas you initially indicated you already had a jar which was not working.

Please provided answers to the two questions I asked previously. Until we get that information, we would not be able to help you.
 
linus dale
Ranch Hand
Posts: 44
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maneesh Godbole wrote:It should be manifest.mf.
What you have posted indicates what happens when you build the jar, whereas you initially indicated you already had a jar which was not working.

Please provided answers to the two questions I asked previously. Until we get that information, we would not be able to help you.



ok ,now it is working .I was opening it with jawaws instead of javaw in the bin folder
jar files open on double click,but ONLY for programs that have GUI output
manifest.txt as well as manifest.mf, it works for both



Why do jar files for simple(command line output) programs do not open on double click?



all jar files(GUI and non gui) open from command line now
>java -jar filename.jar
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic