FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Java applet error.





raneez_n
I wrote a java applet program and executed successfully from my system.
But when i upload the files to my website and open, it fails. Whats the error? plz help..

This is the error shown when i try to open the applet..


Java Plug-in 1.6.0_13
Using JRE version 1.6.0_13 Java HotSpot(TM) Client VM
User home directory = C:\Documents and Settings\internet
----------------------------------------------------
c: clear console window
f: finalize objects on finalization queue
g: garbage collect
h: display this help message
l: dump classloader list
m: print memory usage
o: trigger logging
q: hide console
r: reload policy configuration
s: dump system and deployment properties
t: dump thread list
v: dump thread stack
x: clear classloader cache
0-5: set trace level to <n>
----------------------------------------------------


load: class appCrash.class not found.
java.lang.ClassNotFoundException: appCrash.class
at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.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.IOException: open HTTP connection failed:http://raneez.frih.org/app/appCrash/class.class
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)
... 7 more
Exception: java.lang.ClassNotFoundException: appCrash.class
Stubru Freak
It tries to load http://raneez.frih.org/app/appCrash/class.class, and that location doesn't exist. Could you show the code where you load the appCrash class?
Neilos
Funnily enough I'm having the same problem...

http://www.frihost.com/forums/vt-108051.html

The java applet tries to open...

Code:
http://......frih.org/...applet/class.class


That location doesn't exist as I noted in my post. I cannot figure out why the applet tries to open this when I point it at .../applet.class

it seems to be either the JRE or the frihost.org server playing with things rather than any code errors that I or raneez_n may have made.

I have the latest JRE and I compiled my .java file witht the latest javac. I have no idea why it would want to behave like this.

I have tried lifting <applet> tags out of other 'working' websites. and putting them in the html (remembering to rename the .class file each time). Alas, no success Sad

I have tried googling this problem and I have found many similar issues but nothing that has led me to a conclusion.

Neilos
Neilos
I took some time away from Java cos it started to get all frustrating. I came back to it and spent some time with my head in the Tutorials on Sun Microsystems' website. The problem is simple. I had compiled an application and was trying to open it as an applet. I now have working "Hello world!" applet code.

raneez_n I suggest that you post your java code so that someone can look at it and make it work in an applet rather than just working as an application.

Please see my post if you wish to see my working applet code.

Neilos
raneez_n
import java.applet.*;
import java.awt.*;
import java.lang.*;
import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowEvent;
public class appCrash extends Applet implements ActionListener
{
JLabel lb1;
JPanel center_panel,center_panel1;
JButton b,Db,b1;
JDialog dialog,dialog1;
public void init()
{
try
{
lb1=new JLabel("A program Developed by Ranees");
b=new JButton("Click Here");
b1=new JButton("Close");
add(lb1);
add(b);
add(b1);
b.addActionListener(this);
b1.addActionListener(this);
setVisible(true);
setSize(500,500);
}
catch(Exception e)
{
System.err.print(e);
}
}


public void actionPerformed(ActionEvent ae)
{
try
{
if(ae.getSource()==b)
{
Db=new JButton("Click Me");
Db.addActionListener(this);
JLabel Dl=new JLabel("Just Click and See the magic..ha! ha! ");
JPanel center_panel = new JPanel();
dialog = new JDialog((JFrame)null, "Developed by Ranees",true);
center_panel.add(Dl);
center_panel.add(Db);
dialog.getContentPane().add(center_panel, BorderLayout.CENTER);
dialog.pack();
dialog.setVisible(true);
dialog.setSize(500,500);
}
else if(ae.getSource()==Db)
{
for(int i=0;i<10;i++)
{
JPanel center_panel1 = new JPanel();
dialog1 = new JDialog((JFrame)null, "Ha! Ha! Ha!",true);
dialog1.getContentPane().add(center_panel1, BorderLayout.CENTER);
dialog1.pack();
dialog1.setVisible(true);
dialog1.setSize(500,500);
i--;
}
}
if(ae.getSource()==b1)
{
int exit=JOptionPane.showConfirmDialog(this," Are you sure?");
if(exit==JOptionPane.YES_OPTION)
{
System.exit(0);

}
else if(exit==JOptionPane.NO_OPTION)
{
lb1.setText("Thanks for being here ");
}
}
}
catch(Exception ex)
{
System.err.print(ex);
}
}
}
raneez_n
The above code is the applet program i created.
Please debug it.
Related topics
(official) IE 7 Topic
[Solved] [Java] KeyListener Not Working In Internet Explorer
Does anypne help me about JAVA on UNIX?
java applet not working!!
JavaScript or Java Applet and maybe DHTML codes
Java in Firefox
Java bufferedReader problem
just a java problem
java applet refresh problem
games using java applet
My java applet can not find class file on the server
PHP utf-8 to Java Applet
Java Applet
Java script error
Reply to topic    Frihost Forum Index -> Scripting -> Others

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.