且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

指定Java代理的类路径

更新时间:2023-01-10 11:40:40

Bootstrap类加载器(加载JDK类)和系统类加载器(加载应用程序类)是不同的.

Bootstrap classloader (which loads JDK classes) and system classloader (which loads application classes) are different things.

默认情况下,Java代理由系统类加载器加载,并且可以访问-classpath中指定的类.但是,在您的情况下,由于-Xbootclasspath选项,该代理由引导类加载器加载,并且看不到系统类加载器中的类.

By default, Java agent is loaded by the system classloader, and it has access to the classes specified in -classpath. But in your case the agent is loaded by the bootstrap classloader because of -Xbootclasspath option, and it does not see the classes from the system classloader.

您基本上需要删除-Xbootclasspath,以便代理也可以看到用户类.

You basically need to remove -Xbootclasspath so that the agent could see user classes, too.