Friday, January 02, 2009

OSX java.lang.ClassNotFoundException: com.mysql.jdbc.Driver

While testing a Java package (Jar) that connects to a MySQL instance on my Macbook Pro, I was continuously getting com.mysql.jdbc.Driver errors, regardless of how I configured my classpath. The funny thing is, a simple Java application (not packaged within a Jar) worked fine.

Searching through forums, I finally came across a posting that mentioned placing the jar within /Library/Java/Extensions. Sure enough, this fixed the issue! Not sure why this differs from other environments, but it does.

--Noel