Reputation: 492
I'm having troubl using Derby in a netbeans project on Windows. I've just downloaded and configured Derby and set the CLASSPATH variable to
C:\Apache\db-derby-10.10.1.1-bin\lib\derby.jar;C:\Apache\db-derby-10.10.1.1-bin\lib\derbytools.jar;
When I run the command
java org.apache.derby.tools.sysinfo
everything is as expected, I get the output
------------------ Java Information ------------------
Java Version: 1.7.0_25
Java Vendor: Oracle Corporation
etc.
Now when I run a java program that uses derby straight from the command prompt everything works fine:
>java program
but when I try to run the exact same program from Netbeans I get the following error
ClassNotFoundException: org.apache.derby.jdbc.EmbeddedDriver
>>> Please check your CLASSPATH variable <<<
Why would the driver be working from the command prompt but not from Netbeans? Are there special settings in Netbeans that I'm missing or something?
Upvotes: 1
Views: 2223
Reputation: 492
I've figured it out - you need to add the Derby jar files as libraries in the project properties too:
Right click on project, select project properties, select libraries then 'add JAR/folder'. Navigate to where the derby libraries are (in my case C:\Apache\db-derby-10.10.1.1-bin\lib) then add derby.jar and derbytools.jar to the compile-time libraries.
Upvotes: 3