How to combine multiple JAR files

If you have some JDBC Driver and you like to access in ODBC App then you can use ZappySys JDBC Bridge. However, sometimes dependency is not correctly loaded and you get a missing class file error.

Here are the steps to combine multiple jar files (i.e. dependency) into another Jar file (i.e. JDBC jar file).

Basically jar files are nothing but zip files. You can literally add “.zip” at the end and inspect folders in jar files.

image

What you can do is add dependency folders in the JDBC Jar file using the below steps.

In the below example, we will add slf4j (logging utility) into myjdbc.jar.

  1. Copy slf4j jar file and jdbc driver jar file (e.g. myjdbc.jar) to somewhere … Lets call it c:\jars
  2. Rename it to slf4j.zip
  3. Rename myjdbc.jar to myjdbc.zip
  4. Extract both zip files to two folders (e.g. c:\jars\myjdbc and c:\jars\slf4j folders)
  5. Copy files from slf4j folder to myjdbc (Do not copy META-INF folder)
  6. Now compress myjdbc folder and name it myjdbc.jar
  7. This will include missing dependency