This is my HelloWorld.java file code
import java.applet.Applet;
import java.awt.Graphics;
public class HelloWorld extends Applet {
public void paint(Graphics g) {
g.drawString("Hello world!", 50, 25);
}
}
This is my Hello.html file code
<html>
<body>
Here is the output of my program:
<applet code="HelloWorld.class" width="150" height="25"></applet>
</body>
</html>
Both the files are saved to desktop.
This is what I did:
- Open CMD
- Type cd desktop
- Type javac HelloWorld.java
Note: If no.3 is not working. you need to path java jdk first in local disk (C). Find the java folder then choose any jdk. then copy paste the "C:\Program Files\Java\jdk1.8.0_221" to cmd
4. Type appletviewer Hello.html
eto paps pag sa cmd.