Hallo,
I am trying to load dinamically a .class file, but I don't understand where I do have to place my file in order to be loaded. By using th simple code here below I keep on getting a not found exception. The myClass name should contain also the namespace of myClass? should it be something like "xy.myorg.myClass" ? I tried also that by the class was not found. Where exactly the classloader is looking for it?
thanks
I am trying to load dinamically a .class file, but I don't understand where I do have to place my file in order to be loaded. By using th simple code here below I keep on getting a not found exception. The myClass name should contain also the namespace of myClass? should it be something like "xy.myorg.myClass" ? I tried also that by the class was not found. Where exactly the classloader is looking for it?
thanks
Code:
public class MainClass
{
public static void main(String[] args)
{
ClassLoader classLoader = MainClass.class.getClassLoader();
try
{
Class aClass = classLoader.loadClass("myClass");
System.out.println("aClass.getName() = " + aClass.getName());
}
catch (ClassNotFoundException e)
{
e.printStackTrace();
}
}
}