So I understand that Java applets aren't widely used and not supported in most browsers anymore so I'm wondering if my problem may just be lack of support. I'm using Internet Explorer on Windows 10 to test my HTML file as follows:
<html>
<head>
<title>Title Here</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<object type="application/x-java-applet" height="300" width="550">
<param name="code" value="testpackage.othertest" />
<param name="archive" value="apptest2.jar" />
Applet failed to run. No Java plug-in was found.
</object>
</body>
</html>
And the Java code:
package testpackage;
import java.applet.Applet;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.MediaTracker;
public class othertest extends Applet {
Image picture;
public void init() {
picture = getImage(getCodeBase(), "resources/leaves-00002.png");
resize(1050, 700);
}
public void paint (Graphics g) {
g.drawImage(picture, 10, 10, this);
}
}
The png image is in a folder labeled resources in apptest2/build/classes
.
The applet runs fine in the applet viewer, but using a web application project in NetBeans, the applet displays as a box reading "Error. Click for details" which leads to a popup that says "ClassNotFoundException, testpackage.othertest".
I've tried using testpackage.othertest.class
, using the <applet>
tag instead, and changing the codebase to the path where the .class is, then the .jar file. I'm not sure which command to use to read specific errors in the window as well.
I would appreciate any help and if I'm missing any information needed please let me know!