Basically above code reads mappings.jar which is currently located in c:\
I need to modify the above code in such a way that the JARLoader class should look for mappings.jar in the same folder that has GLUE-STD.jar using relative path not physical path so that app finds the jar file while running on Windows as well as Linux environment.
Really appreciate any suggestions.
Amit M Tank
Joined: Mar 28, 2004
put your folder in the classpath. Use the following code.
(The getClass() method is not static so the above code will not compile. I think this was a typo but just wanted to point out.)
There is a subtle difference between using getResourceAsStream() in java.lang.Class and the one in java.lang.ClassLoader. The former method expects the requested resource to be present in the classpath in the directory structure resembling the package name of the class. So, if your class name is foo.bar.MyClass then the requested resource must be present under foo/bar/ under any of the directories in the classpath. The method in the ClassLoader expects the resource to be present directly in the classpath.
What are you going to do with the InputStream and why? I have the vague feeling that there might be a better way to solve the problem you are trying to solve...
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus