as I was searching for a simple embedded JPA-capable DB to be used in a Java Desktop-Application, I found that Apache Derby / Java DB is a pretty common way to do such things.
I already found that Java DB comes per default with every JRE/JDK-installation since 1.6.
But when jumping into the tutorials there are quite a few steps to install derby...
With ignoring those steps and just trying someting like:
public class Main {
public static void main(String[] args) throws ClassNotFoundException {
Class.forName("org.apache.derby.jdbc.EmbeddedDriver");
}
}
The following exception is thrown:
Exception in thread "main" java.lang.ClassNotFoundException: org.apache.derby.jdbc.EmbeddedDriver
That brings me to my question:
Do I need the end-user to set up any enviroment-variables or something like that? If I only want to ship one JAR (or at least only one folder containing everything what is needed to run my desktop-application) is derby still the right thing to lern more about, or is it a dead end and I should look for SQLite-Libs or something?
You shouldn't need any environment variables if you include the method call that you gave. You do however need to make sure that the JDBC drivers are in your classpath. The simplest way to do this is by setting the classpath in your JAR's manifest file
I recently asked a related question and was directed to check out H2 and HSQLDB. I am working with HSQLDB at the moment and it seems to be fitting my needs which are very similar to your own. I hope this helps!