On 13/10/14 16:19, Alan Bateman wrote:
URL codeBase =
ClassLoader.getSystemResource("javax/management/MBeanServer.class");

Interesting simplification. This looks good to me :-)

I was intrigued by the difference so I tried the following:

System.out.println(ClassLoader.getSystemResource(
     "javax/management/MBeanServer.class"));

System.out.println(javax.management.MBeanServer.class
      .getProtectionDomain().getCodeSource().getLocation());


the second line throws a NPE - which was most probably
the reason for trying to locate rt.jar from java.home in
the first place...

best regards,

-- daniel

Reply via email to