我使用 Eclipse 创建了一个小程序:
package gui;
public class MyApplet extends JApplet {
这个小程序需要两个外部 jar:proj.jar 和 firebirdsql-full.jar (jdbc)
因此,我在与罐子相同的文件夹中创建了这样的 HTML:
<APPLET CODE="gui.MyApplet.class" width="650" height="650" ARCHIVE="proj.jar,myApplet.jar,firebirdsql-full.jar">
<a href="http://java.com/en/download/index.jsp">Java</a>
</APPLET>
我还尝试更改ARCHIVE
属性中的 jar 顺序。
但是我不断收到以下错误(在 java 控制台中):
Exception in thread "thread applet-gui.MyApplet.class-2" java.lang.NoClassDefFoundError: Could not initialize class org.firebirdsql.jdbc.FBDriver
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at db.DAO.getDBConnection(DAO.java:45)
at db.MyDAO.initPreparedStatements(MyDAO.java:37)
at db.MyDAO.<init>(MyDAO.java:33)
at db.MyDAO.getInstance(MyDAO.java:27)
at model.Controller.<init>(Controller.java:27)
at gui.MyApplet.getJTabbedPane(MyApplet.java:81)
at gui.MyApplet.getJContentPane(MyApplet.java:69)
at gui.MyApplet.init(MyApplet.java:52)
at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
我错过了什么吗?
编辑:
不知何故,在调试这个时,我还收到了一个不同的堆栈跟踪:
Exception in thread "thread applet-gui.MyApplet.class-1"
java.lang.ExceptionInInitializerError
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at db.DAO.getDBConnection(DAO.java:45)
at db.MyDAO.initPreparedStatements(MyDAO.java:37)
at db.MyDAO.<init>(MyDAO.java:33)
at db.MyDAO.getInstance(MyDAO.java:27)
at model.Controller.<init>(Controller.java:27)
at gui.MyApplet.getJTabbedPane(MyApplet.java:81)
at gui.MyApplet.getJContentPane(MyApplet.java:69)
at gui.MyApplet.init(MyApplet.java:52)
at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.security.AccessControlException: access denied (java.util.PropertyPermission FBLog4j read)
at java.security.AccessControlContext.checkPermission(Unknown Source)
at java.security.AccessController.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkPropertyAccess(Unknown Source)
at java.lang.System.getProperty(Unknown Source)
at org.firebirdsql.logging.LoggerFactory.getLogger(LoggerFactory.java:36)
at org.firebirdsql.logging.LoggerFactory.getLogger(LoggerFactory.java:72)
at org.firebirdsql.jdbc.FBDriver.<clinit>(FBDriver.java:63)
... 12 more