A
Andreas Solsbach
Hi,
I have some problems with an llegalAccessException when I load a class...
i get the error message form the line "return c.newInstance();"
in agentsystem.PREAgent.PREALocaleFileProcessOneShotBehaviour i want to load
a class
and the classname and the url i get by user input
public Object loadClass(String url, String className)
throws Exception
{
System.out.println("in loadClass");
URL classURL = new File(url).toURL();
URLClassLoader cl = new URLClassLoader(new URL[] {classURL});
Class c = cl.loadClass(className);
return c.newInstance();
}
but that is the error message
java.lang.IllegalAccessException: Class
agentsystem.PREAgent.PREALocaleFileProcessOneShotBehaviour can not access a
member of class neueKlasse with modifiers ""
----------- the class i want to load
publi class neueKlasse {
public neueKlasse (){
System.out.println("NEW CLASS LOADED ");
}
}
__________________
So what i have to change in classloader or in my class neueKlasse ?
Thnx Andreas
I have some problems with an llegalAccessException when I load a class...
i get the error message form the line "return c.newInstance();"
in agentsystem.PREAgent.PREALocaleFileProcessOneShotBehaviour i want to load
a class
and the classname and the url i get by user input
public Object loadClass(String url, String className)
throws Exception
{
System.out.println("in loadClass");
URL classURL = new File(url).toURL();
URLClassLoader cl = new URLClassLoader(new URL[] {classURL});
Class c = cl.loadClass(className);
return c.newInstance();
}
but that is the error message
java.lang.IllegalAccessException: Class
agentsystem.PREAgent.PREALocaleFileProcessOneShotBehaviour can not access a
member of class neueKlasse with modifiers ""
----------- the class i want to load
publi class neueKlasse {
public neueKlasse (){
System.out.println("NEW CLASS LOADED ");
}
}
__________________
So what i have to change in classloader or in my class neueKlasse ?
Thnx Andreas