09-20-2011 04:39 AM
How to load resources from another module such as a library?
I knew the method Class.forName(ClassPath).getResourceAsStream(file
In project A I writed as follows:
Class myClass = Class.forName("Test.MyClass"); //in another module InputStream inStream = myClass.getResourceAsStream("/Test.txt");
The myClass is not null, but the inStream always be null.
I don't know I was wrong or the method itself can not load resources from another module....
Anyone give me some suggestions.
Thanks a lot!