Search code examples
javaeclipsejdbcjarbuildpath

Derby embedded driver - "Class not found" after exporting to application to JAR


I am trying to get Java working with Apache Derby embedded database, and it works fine in eclipse but gives the error

java.lang.ClassNotFoundException: org.apache.derby.jdbc.EmbeddedDriver

when exported to a Jar file and run.

I included the Derby Jar in my project by adding it to the lib folder then referencing it in the build path, so that the jar is in the referenced libraries folder.

Any ideas on how to fix this?


Solution

  • When exporting from Eclipse, the "JAR file" destination will only include your own classes and not the external dependencies they require. To include those dependencies you need to choose "Runnable JAR file" as the destination.

    Eclipse.png