I am trying to read a *.class resource from a package. I am using the following code to achieve this...
URL path = SomeClass.class.getResource("/source/someClass.class");
When I run this code, I end up with path = null;
. However, if I use the same code and try to access other resources such as *.gif and *.txt files, it is successful. Is there a reason why I can't access the *.class files?
May be resource path is incorrect. Because the class directory is special to project.
You can try the following:
URL path = SomeClass.class.getResource("PackagePath/someClass.class");
the PackagePath like "/com/xxx/projectTest".