简体   繁体   中英

Error java.lang.reflect.InvocationTargetException

I have just started to learn about 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.

Below you may find my HTML code sample. Java Example

<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

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. And I have spent many hours by search for the answer.

Your HelloWorldApp is not applet class. To make it applet class it needs to extend Applet or JApplet.

Try this tutorial.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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