Igor Čordaš
Igor Čordaš

Reputation: 5974

How to specify from which jar to read resource

Is it possible to specify from which jar resources are loaded when using:

InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream("file1.sql");

In more detail I am versioning jars with resource files using partly gradle and partly ivy (this is the state the project currently is and I cannot change this). This does work and I get both files-jar-1.0.0 and files-jar-1.0.1 inside my classpath. But how do I specify from which one of these two files I want to read the resource?

Upvotes: 0

Views: 35

Answers (1)

Andres
Andres

Reputation: 10727

You specify this by the order of the jars in the classpath.

Take a look at this: http://docs.oracle.com/javase/7/docs/technotes/tools/solaris/classpath.html

Upvotes: 1

Related Questions