Reputation: 25
My java application consists of two JARs and resource folder, one of the JARs contain a class inside a somepackage and it needs to load a resource file from resources folder in the root of the application outside the JAR contain this class how can this class load the resource file with getClass().getResource() or other method
File Structure
Main Application
-resources
-jar_1
-jar_2
-com
-somepackage
Upvotes: 0
Views: 97
Reputation: 3972
Try this solution:
getClass().getClassLoader().getResourceAsStream("resources/"+docLocation
);
Upvotes: 0