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

extracting all the contents of a jar file

 
mythily prakash
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,

Any one can tell me how to implement the command
"jar -xvf myjar.jar" programmatically.I've written the program as



but it throws the following exception as:

Entry Name: META-INF/
ex.jar opened.
META-INF/ extracted.
ex.jar closed.

Entry Name: META-INF/MANIFEST.MF
ex.jar opened.
ex.jar closed.
Exception in thread "main" java.io.FileNotFoundException: META-INF\MANIFEST.MF (The system cannot find the path specified)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.<init>(FileOutputStream.java:201)
at java.io.FileOutputStream.<init>(FileOutputStream.java:92)
at jara.extract(jara.java:46)
at jara.main(jara.java:14)

Pls tell me how to recover from it.
 
Joni Salonen
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to create the directory first:

 
mythily prakash
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank u Friend,
Here is my code :

Thank u somuch.!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic