jQuery in Action, 3rd edition
The moose likes Beginning Java and the fly likes packaging all packages in an executable jar file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "packaging all packages in an executable jar file" Watch "packaging all packages in an executable jar file" New topic

packaging all packages in an executable jar file

abhishek kunal
Ranch Hand

Joined: Jul 27, 2009
Posts: 42
i have a problem...please have a look on my project directory

so very obviously i have 3 packages , components, others and gui, now i want to make an executable jar file, so i run a command from spinner directory

jar -cvfm myexe.jar meta-inf/manifest.mf components/*.class gui/*.class others/*.class

so , in this way it worked well, but what i want is , i shdnt be specifying all packages...suppose i have 10 packages, so i will need to write all those in command and that i don't want , so is'nt there any wildcard for this? so that all packages are included in jar file automatically...??? in other words i want each and everything in spinner directory to be packaged in jar file without specifying all ....

hope my question is clear...please help!!
Daniel Matthews

Joined: Aug 17, 2009
Posts: 7
Why dont you run the command from the directory above spinner. E.g. jar -cvf myjar.jar spinner/.

Surely if this is your package structure then you would need the spinner directory included anyway. Anyway if not try jar -cvf myjar.jar ./
Balu Sadhasivam
Ranch Hand

Joined: Jan 01, 2009
Posts: 874


*/*.class would work , but for each recursive directories , you need to add */*/*.class depending on... If your OS is unix , then there are other options.
I agree. Here's the link: http://aspose.com/file-tools
subject: packaging all packages in an executable jar file
It's not a secret anymore!