简体   繁体   English

在Netbeans中使用Derby EmbeddedDriver

[英]Using Derby EmbeddedDriver in Netbeans

I'm having troubl using Derby in a netbeans project on Windows. 我在Windows的netbeans项目中使用Derby遇到麻烦。 I've just downloaded and configured Derby and set the CLASSPATH variable to 我刚刚下载并配置了Derby,并将CLASSPATH变量设置为

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: 现在,当我从命令提示符运行直接使用derby的Java程序时,一切正常:

>java program

but when I try to run the exact same program from Netbeans I get the following error 但是当我尝试从Netbeans运行完全相同的程序时,出现以下错误

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? 为什么驱动程序将在命令提示符下工作,而不是在Netbeans上工作? Are there special settings in Netbeans that I'm missing or something? 我缺少Netbeans中的特殊设置吗?

I've figured it out - you need to add the Derby jar files as libraries in the project properties too: 我已经弄清楚了-您还需要在项目属性中将Derby jar文件添加为库:

Right click on project, select project properties, select libraries then 'add JAR/folder'. 右键单击项目,选择项目属性,选择库,然后“添加JAR /文件夹”。 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. 导航到derby库所在的位置(在我的情况下为C:\\ Apache \\ db-derby-10.10.1.1-bin \\ lib),然后将derby.jar和derbytools.jar添加到编译时库中。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 仅当使用EmbeddedDriver时Derby数据库连接问题 - Derby database connection issue only when using the EmbeddedDriver Derby 在使用 Maven 时给出 ClassNotFoundException: org.apache.derby.jdbc.EmbeddedDriver - Derby gives ClassNotFoundException: org.apache.derby.jdbc.EmbeddedDriver while using Maven 我正在尝试使用Java derby EmbeddedDriver创建表,但我不明白这些错误是什么意思? - I am trying to create a table using java derby EmbeddedDriver but i don't understand what these errors mean? 没有Class.forName的Derby EmbeddedDriver - Derby EmbeddedDriver working without Class.forName 使用derby在netbeans中查询嵌入式数据库 - querying embedded database in netbeans using derby 我可以将 Derby EmbeddedDriver 与 Java 教程中指定的 CachedRowSet 示例一起使用吗? - Can I use the Derby EmbeddedDriver with the CachedRowSet example specified in the Java tutorial? 使用 derby 数据库登录 Web 应用程序 (netbeans) - Login using derby database for web app (netbeans) 无法使用NetBeans连接到derby数据库(嵌入式) - unable to connect in derby database(embedded) using netbeans java.lang.ClassNotFoundException:org.apache.derby.jdbc.EmbeddedDriver - java.lang.ClassNotFoundException: org.apache.derby.jdbc.EmbeddedDriver 尝试将JPA与Derby一起使用时ClassNotFoundException:org.apache.derby.jdbc.EmbeddedDriver - ClassNotFoundException: org.apache.derby.jdbc.EmbeddedDriver when trying to use JPA with Derby
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM