Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Regarding Jar Utility

 
Naveen Koneti
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I am struggling with jar utility, to unjar a jar file to a particular folder other than the current directory.Please help me.

Thanks in Advance...
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not an advanced question. Moving...
 
Joanne Neal
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From the Jar tutorial
When extracting files, the Jar tool makes copies of the desired files and writes them to the current directory, reproducing the directory structure that the files have in the archive.

So I guess the answer is - you can't.
 
Muhammad Saifuddin
Ranch Hand
Posts: 1324
Android Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would say use this command "jar ?" on command prompt options will be visible after run it.
 
Naveen Koneti
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi I know how to use the jar utility to unjar a jar file.But I am facing problem with destination where to place the unjarred files.In my project I need to unjar a jar file and place it in a specified directory not in the same directory.

Thanks in Advance...
[ April 27, 2007: Message edited by: Naveen Koneti ]
 
Joanne Neal
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
See the bold part of the quote in my first post.
 
Darrin Cartwright
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Naveen!

You just have to go at it a little backwards.
Invoke the JAR utility in the directory you want to extract the files in, rather that the location of the JAR file itself.
For instance, if you want to extract into the some/other/dir directory, change to that directory first: (cd some/other dir || dir some\other\dir ), and then call jar -xvf ../../../myjarfile.jar

Hope that helps!

Darrin
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic