0

我在编译使用嵌入式 Derby 数据库的 java 程序时遇到问题。我正在使用 Netbeans,并使用了“清理和构建”选项,它创建了一个 dist 文件夹。我将数据库添加到 dist/resources 文件夹中,我有 derby 连接指向的文件夹:

System.setPropert("derby.system.home", System.getProperty("user.dir") + "//resources"

问题是,有些人无法运行该程序。对于某些人来说,只需单击 dist 文件夹中的 .jar 文件即可。对于其他人,它根本不会运行。另外,我已经给了人们整个包,他们在从 Netbeans 运行它时遇到了以下错误:

-do-compile: [javac] 将 11 个源文件编译到 /home/bull/Desktop/asdfasd/build/classes [javac] 注意:一些输入文件使用未经检查或不安全的操作。[javac] 注意:使用 -Xlint:unchecked 重新编译以获取详细信息。[copy] 复制81个文件到/home/bull/Desktop/asdfasd/build/classes [copy] 复制4个空目录到/home/bull/Desktop/asdfasd/build/classes下1个空目录

-编译后:

编译:

运行:[java] java.sql.SQLException:没有为 jdbc:derby:CS242 找到合适的驱动程序 [java] 在 customeremailmanager.CustomerDB.getCustomers(CustomerDB) 的线程“AWT-EventQueue-0”java.lang.NullPointerException [java] 中出现异常.java:105) [java] 在 customeremailmanager.CustomerEmailFrame.(CustomerEmailFrame.java:26) [java] 在 customeremailmanager.CustomerEmailFrame$11.run(CustomerEmailFrame.java:450) [java] 在 java.awt.event.InvocationEvent.dispatch (InvocationEvent.java:251) [java] 在 java.awt.EventQueue.dispatchEventImpl(EventQueue.java:721) [java] 在 java.awt.EventQueue.access$200(EventQueue.java:103) [java] 在 java. awt.EventQueue$3.run(EventQueue.java:682) [java] 在 java.awt.EventQueue$3.run(EventQueue.java:680) [java] 在 java.security.AccessController.doPrivileged(Native Method) [java] at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76) [java] at java.awt.EventQueue.dispatchEvent(EventQueue.java:691) [java] at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:244) [java] 在 java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:163) [java] 在 java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151) [java] 在 java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:147) [java] 在 java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:139) [java] 在 java.awt.EventDispatchThread.run(EventDispatchThread.爪哇:97)doPrivileged(Native Method) [java] at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76) [java] at java.awt.EventQueue.dispatchEvent(EventQueue.java:691) [java] at java.awt。 EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:244) [java] at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:163) [java] at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151) [java] at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:147) [java] 在 java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:139) [java] 在 java.awt.EventDispatchThread.run(EventDispatchThread.java:97)doPrivileged(Native Method) [java] at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76) [java] at java.awt.EventQueue.dispatchEvent(EventQueue.java:691) [java] at java.awt。 EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:244) [java] at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:163) [java] at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151) [java] at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:147) [java] 在 java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:139) [java] 在 java.awt.EventDispatchThread.run(EventDispatchThread.java:97)doIntersectionPrivilege(ProtectionDomain.java:76) [java] 在 java.awt.EventQueue.dispatchEvent(EventQueue.java:691) [java] 在 java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:244) [java] 在 java. awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:163) [java] at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151) [java] at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:147) [java ] 在 java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:139) [java] 在 java.awt.EventDispatchThread.run(EventDispatchThread.java:97)doIntersectionPrivilege(ProtectionDomain.java:76) [java] 在 java.awt.EventQueue.dispatchEvent(EventQueue.java:691) [java] 在 java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:244) [java] 在 java. awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:163) [java] at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151) [java] at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:147) [java ] 在 java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:139) [java] 在 java.awt.EventDispatchThread.run(EventDispatchThread.java:97)pumpOneEventForFilters(EventDispatchThread.java:244) [java] 在 java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:163) [java] 在 java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151) [java] 在 java. awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:147) [java] 在 java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:139) [java] 在 java.awt.EventDispatchThread.run(EventDispatchThread.java:97)pumpOneEventForFilters(EventDispatchThread.java:244) [java] 在 java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:163) [java] 在 java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151) [java] 在 java. awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:147) [java] 在 java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:139) [java] 在 java.awt.EventDispatchThread.run(EventDispatchThread.java:97)147) [java] 在 java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:139) [java] 在 java.awt.EventDispatchThread.run(EventDispatchThread.java:97)147) [java] 在 java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:139) [java] 在 java.awt.EventDispatchThread.run(EventDispatchThread.java:97)

那么我可能在这个程序中做错了什么?这是整个包:http ://wikisend.com/download/969374/CustomerEmailManagerGUI.zip

4

1 回答 1

0

消息“没有为 jdbc:derby: 找到合适的驱动程序:”通常意味着在 CLASSPATH 中找不到 derby.jar 文件。

您是否将 derby.jar 文件作为应用程序的一部分重新分发?如果是这样,也许该过程没有正确安排 jar 在您的应用程序的 CLASSPATH 中。

于 2012-12-08T19:42:14.287 回答