Applet doesnt load onto browser; but runs on appleviewer.
Applet runs fine with appletviewer but doesnt run on browser.
I am getting a stack trace complete with exception; something like :-
load:myApplet is not public or has no public constructor
java.lang.IllegalAccessException: Class sun.applet.AppletPanel can not access a member of class myApplet with modifiers ""
at sun.reflect.Reflection.ensureMemberAccess(Reflection.java:65)
at java.lang.Class.newInstance0(Class.java:344)
at java.lang.Class.newInstance(Class.java:303)
at sun.applet.AppletPanel.createApplet(AppletPanel.java:721)
at sun.plugin.AppletViewer.createApplet(AppletViewer.java:1760)
at sun.applet.AppletPanel.runLoader(AppletPanel.java:650)
at sun.applet.AppletPanel.run(AppletPanel.java:324)
at java.lang.Thread.run(Thread.java:595)
I have double checked there is no such method which calls a method that doesnt have access to it.
Please guide.
Thanks.
> can you show the first lines of your applet (class
> declaration + constructor)
I think, the solution to this problem is in this line :
java.lang.IllegalAccessException: Class sun.applet.AppletPanel can not access a member of class myApplet with modifiers ""
-- what does the last part of line :-class myApplet with modifiers "" signify?
Getting any clue?
Plz guide.
Thanks
> I shall try and put my code here soon (after making
> some changes for making it general) but for now, if
> the doubt is about the public constructor,I have
> duely added it, though I dont need it.
--Here is the code..
import java.net.*;
import java.io.*;
import java.applet.*;
public class myApplet extends Applet
{
//Temperory method
void call()
{
System.out.println("Method called..../////");
}
public myApplet()
{
System.out.println("Constructor called.....");
}
public void start()
{
call();
}
}
> can you show the first lines of your applet (class
> declaration + constructor)
I am using this command for running using appletviewer as an workaround for security related issues :
appletviewer -J-Djava.security.policy=polfile myApplet.html.
In the html file, I have added jar file as a value to attribute 'archive'.
Plz help...