[英]InvocationTargetException when running an applet from the browser
I have an applet that uses the Processing (http://www.processing.org) library. 我有一个使用处理(http://www.processing.org)库的小程序。 The processing lib is contained in core.jar
I'm trying to embed it in a webpage. 处理库包含在core.jar
我正在尝试将其嵌入网页中。 Here is the html 这是HTML
<html>
<body>
<applet width=300 height=300 code="Applet.class" archive="core.jar">
no applet
</applet>
</body>
</html>
The applet code is below 小程序代码如下
import processing.core.*;
import java.util.ArrayList;
class Heart extends PApplet //subclass of Applet
{
Particle p;
ArrayList<Particle> particles;
PImage heart;
public void setup() //These are overrides of PApplet methods
{
...do stuff...
}
public void draw() //These are overrides of PApplet methods
{
...more stuff....
}
PVector randVec(float min, float max)
{
...etc etc....
}
}
I can post the full applet code but I don't know if it's necessary. 我可以发布完整的applet代码,但我不知道是否有必要。
When I load the .html page. 当我加载.html页面时。 I get a java.lang.reflect.InvocationTargetException. 我得到了一个java.lang.reflect.InvocationTargetException。 There is no stack trace in the Java Console. Java控制台中没有堆栈跟踪。
2 problems: 2个问题:
1) Heart class should be public: 1)心脏课应公开:
public class Heart extends PApplet {
...
2) Your applet tag should read: 2)您的applet标签应显示为:
<applet width=300 height=300 code="Heart.class" archive="core.jar">
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.