Hello all!
I have the following code:
// Test TODO remove
try {
System.out.println(System.getProperties().getProperty("java.class.path"));
this.getClass().getClassLoader().loadClass("mypackage.MyClass");
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Now the output shows me, that the class is on the classpath, i.e.:
/...some/path.../workspace/project/target/test-classes:/rest/of/the/classpath
java.lang.ClassNotFoundException: mypackage.MyClass
...here be stacktrace...
I also made sure, that the class-file acutaly IS in the given location, i.e. this file exists:
/...some/path.../workspace/project/target/test-classes/mypackage/MyClass.class
Maybe the following is important: the shown code is executed in a javaagent attached to a jUnit test, that I start programtically (via Runtime.execute(...)) - so there is probably something beyond the obvious that can go wrong in the background... but still: if the classpath contains the folder with the class, how come it cannot be loaded?