I went to the official JAVA forum, but either those guys there have no clue how to solve this or there's no solution to it, in which case, Java applets are useless and java should stop pimping it.
I have to say, this is the most frustrated I've been at Java in my life.
Anyways, I created an applet in my eclipse IDE and ran it. It works. I decided to create a HTML file so that the applet would display on my firefox browser (my browser has no problem displaying java applets. All settings are fine).
This is my HTML code:
<html>
<title>Site Selector</title>
<body>
<applet code = "SiteTesting.class" width = "300" height = "75">
</applet>
</body>
</html>
Now, my eclipse IDE creates a "src" or source folder and a bin folder. The bin folder is where the class files are kept. The HTML file was in the src folder. When I ran it, I got this:
load: class SiteTesting.class not found.
java.lang.ClassNotFoundException: SiteTesting.class
at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadCode(Unknown Source)
at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source)
at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.io.FileNotFoundException: F:\Workspace\RefreshalCourse\src\networking\SiteTesting\class.class (The system cannot find the path specified)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(Unknown Source)
at java.io.FileInputStream.<init>(Unknown Source)
at sun.net.www.protocol.file.FileURLConnection.connect(Unknown Source)
at sun.net.www.protocol.file.FileURLConnection.getInputStream(Unknown Source)
at sun.plugin2.applet.Applet2ClassLoader.getBytes(Unknown Source)
at sun.plugin2.applet.Applet2ClassLoader.access$000(Unknown Source)
at sun.plugin2.applet.Applet2ClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
... 9 more
Exception: java.lang.ClassNotFoundException: SiteTesting.class
I realised I was running the HTML file from the src folder where the .class file isn't located, so I moved the HTML file to the bin folder where the .class file is located, and I got this:
java.lang.NoClassDefFoundError: SiteTesting (wrong name: networking/SiteTesting)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(Unknown Source)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadCode(Unknown Source)
at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source)
at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Exception: java.lang.NoClassDefFoundError: SiteTesting (wrong name: networking/SiteTesting)
Can someone please tell me what's wrong? I've been moving files from place to place and I cannot for the love of God figure out why my HTML file won't display on my browser just as every tutorial out there on the net says it should