| | |
Trying to add a simple applet to a web page
![]() |
•
•
Join Date: Feb 2008
Posts: 3
Reputation:
Solved Threads: 0
Well, I was trying to add a simple applet to a web page(php nuke Home section), it didn't fin my applet, so I changed it and added it to a simple html file to make it as simple as I could get it.
This is the code in the html file:
The directory: www/usblock.html & www/usblock.java & www/usblock.class - As you can see the files are all in the same directory/folder.
usblock.java code:
now as I open the html local on my computer, it workes. As soon as I open the usblock.html from my website, it doesn't.
It gives me this error here:
So I thought it was that it couldn't find the .class file. Well, I went through the How To add applets that I found somewhere on sun.com. It had exactly the same as I had.
Im figuring the problem is something easy and not hard to detect. But my eyes can't find it somehow. This is my second time trying applets, and I kinda forgot how I got it to work the first time.
Im just glad for all the help I can get.
Thanks a lot.
LordSvae
PS: Sry for the size of the post, but I'm not sure how much info I was supposed to put in here, so I thought the more the better, right?
This is the code in the html file:
Java Syntax (Toggle Plain Text)
<applet code="usblock.class" width="400" height="400">The browser doesn't support applets...</applet>
The directory: www/usblock.html & www/usblock.java & www/usblock.class - As you can see the files are all in the same directory/folder.
usblock.java code:
Java Syntax (Toggle Plain Text)
import javax.swing.*; import java.awt.*; public class usblock extends JApplet { public void init() { JPanel p = new JPanel(new BorderLayout()); p.add(new JLabel("Heisann")); add(p, BorderLayout.CENTER); } }
now as I open the html local on my computer, it workes. As soon as I open the usblock.html from my website, it doesn't.
It gives me this error here:
Java Syntax (Toggle Plain Text)
load: class usblock.class not found. java.lang.ClassNotFoundException: usblock.class at sun.applet.AppletClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.applet.AppletClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.applet.AppletClassLoader.loadCode(Unknown Source) at sun.applet.AppletPanel.createApplet(Unknown Source) at sun.plugin.AppletViewer.createApplet(Unknown Source) at sun.applet.AppletPanel.runLoader(Unknown Source) at sun.applet.AppletPanel.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Caused by: java.io.IOException: open HTTP connection failed. at sun.applet.AppletClassLoader.getBytes(Unknown Source) at sun.applet.AppletClassLoader.access$100(Unknown Source) at sun.applet.AppletClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) ... 10 more
So I thought it was that it couldn't find the .class file. Well, I went through the How To add applets that I found somewhere on sun.com. It had exactly the same as I had.
Im figuring the problem is something easy and not hard to detect. But my eyes can't find it somehow. This is my second time trying applets, and I kinda forgot how I got it to work the first time.
Im just glad for all the help I can get.
Thanks a lot.
LordSvae
PS: Sry for the size of the post, but I'm not sure how much info I was supposed to put in here, so I thought the more the better, right?
![]() |
Similar Threads
- Problem with "extra slow" computer. please help!!! (Viruses, Spyware and other Nasties)
- applet not showing up (Java)
Other Threads in the Java Forum
- Previous Thread: Help regarding the updating of the user interface..
- Next Thread: linked list help
| Thread Tools | Search this Thread |
911 actionlistener addressbook android api append applet application array arrays automation binary blackberry block bluetooth character chat class client code component consumer csv database desktop developmenthelp eclipse error fractal ftp game givemetehcodez graphics gui html ide image integer j2me j2seprojects japplet java javaarraylist javac javaee javaprojects jni jpanel julia lego linked linux list loops mac map method methods mobile netbeans newbie number objects online oriented panel printf problem program programming project projects properties recursion replaydirector reporting researchinmotion rotatetext rsa scanner se server set singleton sms sort sql string swing test textfields threads time title tree tutorial-sample ubuntu update windows working





