Where to Put Java Extensions on Mac OS X

A couple weekends ago I spent hours and hours trying to get a JDBC driver to be recognized on my Mac OS X system. I fiddled with the CLASSPATH for days and no matter what I did, I kept getting ClassNotFoundExceptions when I tried to load the driver.

A couple weekends ago I spent hours and hours trying to get a JDBC driver to be recognized on my Mac OS X system. I fiddled with the CLASSPATH for, literally, days, and never got it to work. No matter what I did, I kept getting ClassNotFoundExceptions when I tried to load the driver, and other errors that indicated my driver could not be found.

Then, after browsing the MacJavaDev mailing list archives for hours and trying every likely looking tip, I finally hit the one post with the information I needed.

So, hopefully this will help you. To install a new Java library on a Mac OS X system, put the JAR file into /Library/Java/Extensions (if everyone on your system needs it) or ~/Library/Java/Extensions (if it will only be used by you).

So, to be crystal clear, the path to the MM.MySQL JDBC driver on my system is:

~/Library/Extensions/Java/mm.mysql-2.0.13-bin.jar

With the driver installed in this location, I don’t need to do anything to my CLASSPATH to be able to load and use the driver.

Hope this helps!