[英]Embedding Applet in JSP ClassNotFoundException
I'm trying to embed an applet I wrote into a JSP but for some reason no matter what I try I get a ClassNotFoundException
. 我试图将编写的applet嵌入到JSP中,但是由于某种原因,无论我尝试什么,都会得到
ClassNotFoundException
。
Here is my applet: 这是我的小程序:
import javax.swing.*;
import java.awt.*;
public class HelloWorld extends JApplet {
public void init() {
final MyDataAccessObject dao = new MyDataAccessObject();
try {
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
JLabel lbl = new JLabel("Hello World");
Container content = getContentPane();
content.add(AnotherGui.getGUI());//add rootNode to JFRame
dao.connectToDB();
}
});
} catch (Exception e) {
System.err.println("createGUI didn't complete successfully");
}
}
}
My JSP isn't anything too complicated. 我的JSP并不是太复杂。 Right now I'm just trying to drop the Applet into it and run it in the browser.
现在,我只是试图将Applet放入其中并在浏览器中运行它。 Here are the ways I have tried that have not worked :
这是我尝试过的无效方法 :
<applet code="HelloWorld.java" name="HelloWorld" archive="HelloWorld.jar"> </applet>
<applet code="HelloWorld.class" width="350" height="350">.</applet>
<applet codebase="dist/" archive="HelloWorld.jar" code="src.HelloWorld"> </applet>
I am running out of ideas on what to do here! 我没有在这里做什么的想法!
Additional information: 附加信息:
尝试忽略.java
因此,如果您提供的HelloWorld
类没有包声明,请尝试:
<applet code="HelloWorld" name="HelloWorld" archive="HelloWorld.jar"> </applet>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.