-1

I am trying to write a program in Java, which would collect a specified set of files from the physical location and place them in a jar in a certain directory.

I know I can use java.util.jar package for this. The package is great for sure, but I was wondering if there are any third party libraries that anyone at SO has used which they could recommend.

TL;DR: pick up files, create jar by placing them in pre-defined directories, all at run time in a java file.

P.S: I did not find any similar references to this question, but if there are then please refer me. Also, the title might be misleading, but I didn't find better words to explain my problem.

EDIT 1: I am not in anyway saying java.util.jar is bad or incomplete. All I am asking is if anyone has used any alternative solutions!

EDIT 2: I am trying to create the jar from inside the java program. The jar can be pretty big (~500mb) too. Trying to jar media files as well. So simply put, I pick up various files from certain locations on my drive and try to create a jar file by placing them in standard locations.

Thanks,
Ivar

topgun_ivard
  • 8,376
  • 10
  • 38
  • 45
  • 1
    Can you explain what functionality you need that is missing in `java.util.jar`? – Miserable Variable Aug 14 '12 at 17:41
  • [This post](http://stackoverflow.com/questions/5295233/create-a-jar-file-from-the-java-code) gives a few pointers (and the java.util.jar way does not seem to convince many!). It all comes down to using the jar tool, which you can always call from java (process.exec(...)). – assylias Aug 14 '12 at 17:42
  • @Miserable Variable: I am just looking for an easier alternative. – topgun_ivard Aug 14 '12 at 18:04
  • @leonbloy Yes, I am trying to create the jar from inside the java program. The jar can be pretty big (~500mb) too. Trying to jar media files as well. So simply put, I pick up various files from certain locations on my drive and try to create a jar file by placing them in standard locations. – topgun_ivard Aug 14 '12 at 18:06

1 Answers1

1

Look at the java.util.zip package. Jars are just zip files with some extra stuff in 'em

Chris Gerken
  • 16,221
  • 6
  • 44
  • 59