I'm writing an simple applet using JDK-14 in MyApp.java
:
public class MyApp extends Applet {
public void paint(Graphics g) {
g.drawString("My App", 20, 20);
}
}
Then I created index.html
and add the following line to <head>
tag:
<applet code="MyApp.class" width=200 height=600></applet>
When I saved and reload my web page in Chrome
, nothing displayed.
Then, I tried to execute the MyApp.java
run it in Terminal
, the following error occured:
Note: MyApp.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Error: Main method not found in class MyApp, please define the main method as:
public static void main(String[] args)
or a JavaFX application class must extend javafx.application.Application
I read that the applet
doesn't require public static void main(String[] args)
.
Is there any problem with Chrome or I didn't import something ?