I have this code
InputStream stream1 = ResponseCreator.class.getResourceAsStream("version.properties");
InputStream stream2 = ResponseCreator.class.getResourceAsStream("/version.properties");
InputStream stream3 = ResponseCreator.class.getClassLoader().getResourceAsStream("version.properties");
InputStream stream4 = ResponseCreator.class.getClassLoader().getResourceAsStream("/version.properties");
System.out.println("result1="+stream1);
System.out.println("result2="+stream2);
System.out.println("result3="+stream3);
System.out.println("result4="+stream4);
and the results are...
result1=null
result2=java.io.BufferedInputStream@75412c2f
result3=java.io.BufferedInputStream@282ba1e
result4=null
That seems very odd and inconsistent and I even see posts saying stream1 is the way to go and that doesn't even work for me (eclipse IDE run, Intellij IDE run on MAC both yield the same)
I was running jdk8 and now I tried with 11 which is what we run now. Here is the results..
INFO: Starting Development Server under java version=11.0.5
result1=null
result2=sun.net.www.protocol.jar.JarURLConnection$JarURLInputStream@3b220bcb
result3=sun.net.www.protocol.jar.JarURLConnection$JarURLInputStream@2b95e48b
result4=null