-1

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?

ROMANIA_engineer
  • 54,432
  • 29
  • 203
  • 199
Art Hur
  • 3
  • 3
  • I know that 'org.apache.derby.jdbc.EmbeddedDriver' exists because I can see it when viewing the referenced libraries folder on Eclipse – Art Hur Feb 03 '16 at 16:25
  • When you performed the Export did you specify "Java > Runnable JAR file" as the destination? – Gord Thompson Feb 03 '16 at 17:37
  • Hi Gord, I have just exported it as a Runnable Jar and that fixed the problem. Thanks :) – Art Hur Feb 03 '16 at 18:10

1 Answers1

0

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

Gord Thompson
  • 116,920
  • 32
  • 215
  • 418