简体   繁体   English

错误java.lang.reflect.InvocationTargetException

[英]Error java.lang.reflect.InvocationTargetException

I have just started to learn about Java. 我刚刚开始学习Java。 I have figured out how to compile my program and run it. 我已经弄清楚了如何编译我的程序并运行它。 My final goal is to create some animation on Java for web. 我的最终目标是在Java for Web上创建一些动画。

Below you may find my HTML code sample. 您可以在下面找到我的HTML代码示例。 Java Example Java示例

<Body>
This is my page<br>
Below you see an applet<br>

<Applet Code="HelloWorldApp.class" width=200 Height=100>
</Applet>

</Applet>
</Body>
</Html> 

Here is a code of my HelloWorldApp.java 这是我的HelloWorldApp.java的代码

class HelloWorldApp {
    public static void main(String[] args) {
        System.out.println("Hello World!"); // Display the string.
    }
}

Please visit my webpage to see the result of all my job. 请访问我的网页以查看我所有工作的结果。 - http://web.ics.purdue.edu/~vstadnyt/java/ Unfortunately, It doesn't work. -http : //web.ics.purdue.edu/~vstadnyt/java/不幸的是,它不起作用。 And I have spent many hours by search for the answer. 我花了很多时间来寻找答案。

Your HelloWorldApp is not applet class. 您的HelloWorldApp不是applet类。 To make it applet class it needs to extend Applet or JApplet. 要使其成为applet类,需要扩展Applet或JApplet。

Try this tutorial. 试试这个教程。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM