5

I have a Java application that uses a JAR. The JAR has some resource files which it accesses from its own class.

In the jar, this lists the resource files present in the targets/classes folder:

ClassLoader loader = PolicyHelper.class.getClassLoader();
InputStream in = loader.getResourceAsStream("./");
BufferedReader rdr = new BufferedReader(new InputStreamReader(in));
String line;

try {
    while ((line = rdr.readLine()) != null) {
        System.out.println("file: " + line);
    }
    rdr.close();
} catch(Exception e) {}

However, when I include this JAR as a Maven dependency in another Java project, it lists out the files that belong to the new project - NOT the jar.

Is there a solution to this?

IQbrod
  • 2,060
  • 1
  • 6
  • 28
awesomemypro
  • 531
  • 1
  • 11
  • 32

0 Answers0