I am trying to embed applet into an html page and view it in a browser, but i am unable to view it in any of the browsers. (Firefox, Chrome, Edge, Internet Explorer are the browsers i have checked, and also i have enabled the java applets in all of the above.)
Below is my code for applet.java file.
import java.applet.Applet;
import java.awt.Graphics;
public class MyApplet extends Applet {
@Override
public void paint(Graphics g) {
g.drawString("Hello applet!", 50, 25);
}
}
Below is the code for html file.
<html>
<head>
<title>First Applet</title>
</head>
<body>
<p>This is my first applet.</p>
<embed code="MyApplet.class"
codebase="."
type="application/x-java-applet;version=1.8">
<noembed>
No Java Support.
</noembed>
</embed>
</body></html>
.class file, .java file and .html files are all in the same folder.