My top level debug class as specified in the debug configuration is
MyDebugClass. Further down in the
main, it attempts to launch an instance of class
ProblemClass que sea en el mismo paquete as
MyDebugClass but it errors out on the constructor invocation line saying "Source not found". The project compiles fine and the .class file is indeed in the target directory, the same place as the .class for
I thought there may have been something odd with the classpath so that the same package where the debug main is not included so I made a test class in the same directory and tried to invoke an instance of it and that worked. So that is not the problem.
I also added the following code in
MyDebugClass.main to try to debug the issue:
ClassLoader loader = ProblemClass.class.getClassLoader(); Class probCls = loader.loadClass("mypackage.ProblemClass"); //here below is where it errors out probCls.newInstance();
What could possibly be causing this kind of class loading problem? There is a whole bunch of jars in the classpath so could it be that one of them contains this same class qualifier and the class loader is trying to pick it up from there and not the target directory as specified in the debug build path? How do I find from where the class loader is attempting to load a class, e.g. file system path looking for a .class file or some jar?
preguntado el 09 de septiembre de 13 a las 20:09
Look at the file in the Eclipse "Package Explorer" view. That may give you some help. Also, you say that the .class file is in the target directory, but what about the source .java file?
Other things to check are the Java Build Path of your project properties.
I hope this helps, though you didn't really give enough detail to be able to understand what's really going on.