Hi John and thank you for your welcoming post
Thanks for your reply, but that was not what I was searching for. I tried to run jar with your command, but I still have same results: cannot load resource file from jar other then jar where static main resides.
Problem is, that I have loader class in execution.jar that loads xml file (type of file is not important) from schemas.jar. I use:
to load that file and I have no problem with that within Eclipse. However, when I export these to jar from Eclipse (or using maven package), I get nullpointer exception since that getResourceAsStream cannot read file from schemas,jar.
Interestingly enough, I can read .class files in raw format from schemas.jar (I have placed for the sake of
testing some code there). It seems that any type of file, other then .class, is unavailable from jars other then jar where main method is. For some reason, I have no problem accessing resource files placed in execution.jar, but I can't access any file (other then class) from schemas.jar. I renamed schemas.jar to schemas.zip and those xml files are physically available in schemas.jar, but not loaded on classpath.
My conclusion, for the time being is, that on classpath only resources from jar than contains requested static main method are loaded. Resources from other jar files are unavailable, except for java compiled class files.
Perhaps there is an explicit command that tells jvm to make resource files available on classpath. Maybe Eclipse, for testing purposes, packs compiled files in different manner, or even has its own classloader that can access those resource files.
Any ideas now?
Thanks in advance