On 13/10/2014 15:35, Daniel Fuchs wrote:
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...
You may be right and the original author didn't think of getSystemResource. Thanks for the review.

-Alan

Reply via email to