Classloader IllegalAccessException

  • Thread starter Andreas Solsbach
  • Start date
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,968
Messages
2,570,153
Members
46,699
Latest member
AnneRosen

Latest Threads

Top