log.debug("log1 = {}", Server.class.getResource("keystore.jks")); log.debug("log2 = {}", Server.class.getResource("/keystore.jks")); log.debug("log3 = {}", getClass().getResource("keystore.jks")); log.debug("log4 = {}", getClass().getResource("/keystore.jks")); log.debug("log5 = {}", getClass().getClassLoader().getResource("keystore.jks")); log.debug("log6 = {}", getClass().getClassLoader().getResource("/keystore.jks"));
15:46:10.008 [main] DEBUG com.server.lib.Server -- log1 = null 15:46:10.015 [main] DEBUG com.server.lib.Server -- log2 = file:/C:/Dev/gitRepositories/SimpleWebServer/target/classes/keystore.jks 15:46:10.015 [main] DEBUG com.server.lib.Server -- log3 = null 15:46:10.016 [main] DEBUG com.server.lib.Server -- log4 = file:/C:/Dev/gitRepositories/SimpleWebServer/target/classes/keystore.jks 15:46:10.016 [main] DEBUG com.server.lib.Server -- log5 = file:/C:/Dev/gitRepositories/SimpleWebServer/target/classes/keystore.jks 15:46:10.017 [main] DEBUG com.server.lib.Server -- log6 = null
Findings…
class.getResource(
) orgetClass().getResource()
with slashgetClass().getClassLoader().getResource
without slash