creating a jar file, merging .class and all other files in a jar file

Reading Time: < 1 minute

I neeed to create so called a uber jar which holds all necessary jars of oracle netezza and ibm db2 all together. so here is what I did,

I decompressed all jars in one folder

dbuber1

and after everything was unpacked the folders seems like below

dbuber2

copy folder path and first of all we need to specify the path of jdk

set path=%PATH%;C:\jdk1.6.0_25\bin

and navigate to the folder where you’ve extracted the class files

jar cvf nametobegiven.jar *.* META-INF

dbuber3

as you see the file has just created, for nametobegiven is where you assign a new name to the file and *.* includes anything in that folder or you can specify files to be included as well