0

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!

Grace Yang
  • 15
  • 5
  • "So I understand that Java applets aren't widely used and not supported in most browsers anymore" if you understand that why are you developing one ? you understand that they're going to be deprecated as of Java 9 right ? – niceman Jun 13 '17 at 21:27
  • Is it so bad to want to try it? – Grace Yang Jun 14 '17 at 15:31
  • well it's going to be a deprecated technology , if you're interested at running a java desktop app on the browser I've heard about java Web Start and javafx – niceman Jun 14 '17 at 15:34
  • Wouldn't JavaFX use the same type of code? I think I used it once a while ago for a class and made an application, but we didn't try to put it in a browser. – Grace Yang Jun 14 '17 at 16:01
  • ok I was wrong see T.J. Crowder's answer here : https://stackoverflow.com/questions/19102000/javafx-can-it-really-be-deployed-in-a-browser (but KIC's answer looks promising) – niceman Jun 14 '17 at 17:54
  • I see, thank you for the reference! – Grace Yang Jun 15 '17 at 14:19

1 Answers1

0

I've just discovered that on windows 10, IE is the only browser able to load applets. classnotfoundexception was displayed due to probably different export jar file configuration in Eclipse.