Search code examples
jdbcderbyosx-yosemitejavadb

ClassNotFoundException: org.apache.derby.jdbc.EmbeddedDriver on OS X Yosemite


I use the version of Java 7 that comes with OS X Yosemite. My understanding is that Oracle by now ships Java DB (i.e. Derby) with Java, so perhaps I have it already installed.

I currently get a ClassNotFoundException when attempting Class.forName("org.apache.derby.jdbc.EmbeddedDriver").

Am I supposed to somehow add the driver from a local directory, or do I have to get it extra (e.g. because OS X comes with a JRE but not JDK)?

If the second is true, where should I get it from (i.e. are there any differences between drivers from Apache and Oracle)?


Solution

  • Although Derby (or JavaDB) is installed together with the JDK (at least with Java 7, not sure if they still do with Java 8), it is not part of Java itself. This means you still need to include it in the classpath yourself.