Hallo,
i have following line of code:
InputStream passoloExportFileInputStream = getClass().getClassLoader().getResourceAsStream("/com/thinkplexx/lang/de/general.xml");
and i know that jar with com/thinkplexx/lang/de/general.xml is in classpath.
It worked under "previous environment", which is maven2 build.
Now, i evaluate maven3 and it doesn't work! I know, that if i change the code to be:
InputStream passoloExportFileInputStream = getClass().getClassLoader().getResourceAsStream("com/thinkplexx/lang/de/general.xml");
it works great (i just removed the first slash from the resource path).
Btw, i use Linux. First slash in path normally means "from the root directory", so if this logic is sound for java resource loading as well, first example should never have worked!?
Questions: is something wrong with the first code sample, i.e. with /com/ and not com/? Is it just bad code or it means something different?
thank you!
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…