Well, so I was working on my B.Tech Project when I had the need to update the real time data in a database. So the obvious choice for `MySQL`, following that the connector used was JDBC.

( Those who want to learn MySQL, visit W3Schools. )

( People with issues in JDBC, Google! You’ll get a hell lot of tutorials for that. It’s just as in any other Java program, and not specific to MACSimJX in any way )

So, the steps are as follows:

1. Download JDBC driver from MySQL website

2. Extract/Install the download. If you extract, copy the mysql-connector-java-5.1.34-bin.jar file. (The version may vary), and rename to mysqlConnector.jar for simplicity, and copy to C:\\macsimjx\lib\ folder.

3. Now it’s time to play with macsimjx.jar. Extract this jar file using WinRAR or similar software. You get a folder macsimjx as follows:

macsimjx\

-- macsimjx\


-- META-INF\


-- runjar.class

4. Inside the folder META-INF\, you’ll get a file MANIFEST.MF. Edit it with your favorite text editor (I use Notepad++), and you’ll get following contents.

Manifest-Version: 1.0

Class-Path: lib/jade.jar lib/macsim.jar lib/http.jar lib/jadeTools.jar


lib/iiop.jar ATFs/classes/


Created-By: 1.5.0_12 (Sun Microsystems Inc.)


Main-Class: runjar


Name: C Robinson


 

5. Edit that file to add lib/mysqlConnector.jar to Class-Path:. The updated manifest file will be as follows:

Manifest-Version: 1.0

Class-Path: lib/jade.jar lib/macsim.jar lib/http.jar lib/jadeTools.jar lib/mysqlConnector.jar


lib/iiop.jar ATFs/classes/


Created-By: 1.5.0_12 (Sun Microsystems Inc.)


Main-Class: runjar


Name: C Robinson


 

NOTE Do not delete any character, not even the characters at the end of the file. That may cause the jar to get unstable.

6. Once you’ve updated the manifest file, it’s time to repack the jar. For that, open the command line in the current directory C:\\macsimjx\macsimjx\. Execute following command to repack the jar file.

jar cmf META-INF/MANIFEST.MF macsimjx.jar runjar.class macsimjx

7. Now you get an updated macsimjx.jar. You can use this for executing database operations using MACSimJX!

Warnings:

1. Make a backup before starting.

2. Do no delete ending lines of manifest line, even if they seem to be empty.

P.S.

Similar approach can be used to add external files and external jars to existing jar.

Also, in case you have to include many jars in the Class-Path, add all the jars to a folder lib, and in the manifest file, add lib/*.jar under Class-Path:

Any queries regarding macsimjx, jade, mysql, java, jdbc or anything, write a comment below and I’ll be happy to help.

Leave a Reply

Your email address will not be published. Required fields are marked *