jdk/test/java/lang/instrument/BootClassPath/Agent.java
changeset 36511 9d0388c6b336
parent 5506 202f599c92aa
equal deleted inserted replaced
36510:043f1af70518 36511:9d0388c6b336
    31  */
    31  */
    32 import java.lang.instrument.Instrumentation;
    32 import java.lang.instrument.Instrumentation;
    33 
    33 
    34 public class Agent {
    34 public class Agent {
    35     public static void premain(String options, Instrumentation ins) throws Exception {
    35     public static void premain(String options, Instrumentation ins) throws Exception {
    36         String bootclasspath = System.getProperty("sun.boot.class.path");
    36         Class<?> c = Class.forName("AgentSupport");
    37         System.out.println("bootclasspath: " + bootclasspath);
       
    38 
       
    39         Class c = Class.forName("AgentSupport");
       
    40         ClassLoader cl = c.getClassLoader();
    37         ClassLoader cl = c.getClassLoader();
    41         if (cl != null) {
    38         if (cl != null) {
    42             System.err.println("AgentSupport loaded by: " + cl);
    39             System.err.println("AgentSupport loaded by: " + cl);
    43             throw new RuntimeException("AgentSupport class not loaded by boot class loader");
    40             throw new RuntimeException("AgentSupport class not loaded by boot class loader");
    44         } else {
    41         } else {