Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Jar packager

 
Jason Kretzer
Ranch Hand
Posts: 280
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to build an application that will put into a jar file 2 classes, a text file, my manifest, and all the files(subdirs included) in a directory. I then would like to take the jar that was created from this process and extract it to another computer with the relative directory structure intact.
I have posted several times to several places concerning where to get started. So, before people say "look in java.util.jar in the Java API". Know that I have and I find it woefully inadequate to address this question when I have never used streams or zips before.
If anyone has done this before, could you please share your source code?
Thanks!
Jason R. Kretzer
 
Kenneth Reising
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could execute a command line argument to Jar this up with something like this:

Note that this is probably not the most eligant way of doing it, however, it does function.
Just build a commandLine to Jar up what you like, moving the extra files you want into the directory first.

[This message has been edited by Kenneth Reising (edited July 30, 2001).]
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I'm facing the same problem with streams. I'm trying to extract files from a zip file. I search, using Yahoo, for ZipInputStream. That helped and my little app is now working.
Look at this: http://www.javaworld.com/javaworld/jw-11-1998/jw-11-howto_p.html, with code examples.
Cheers
Torgny
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic