Life with teacher Lemon.

查看Java进程加载的类

2022.06.28 | 共 105 字,阅读需约 1 分钟.

如何查看 Java 进程加载了哪些类呢?

方法一:可以将 -verbose:class 添加到 JVM 参数中,启动进程后,可以看到以下类似信息

[Loaded org.springframework.oxm.Marshaller from file:/Users/vixots/.m2/repository/org/springframework/spring-oxm/5.3.21/spring-oxm-5.3.21.jar]
[Loaded org.springframework.oxm.Unmarshaller from file:/Users/vixots/.m2/repository/org/springframework/spring-oxm/5.3.21/spring-oxm-5.3.21.jar]
[Loaded org.springframework.boot.autoconfigure.condition.ConditionEvaluationReport$ConditionAndOutcomes from file:/Users/vixots/.m2/repository/org/springframework/boot/spring-boot-autoconfigure/2.7.1/spring-boot-autoconfigure-2.7.1.jar]
[Loaded org.springframework.boot.autoconfigure.condition.ConditionEvaluationReport$ConditionAndOutcome from file:/Users/vixots/.m2/repository/org/springframework/boot/spring-boot-autoconfigure/2.7.1/spring-boot-autoconfigure-2.7.1.jar]
[Loaded org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication from file:/Users/vixots/.m2/repository/org/springframework/boot/spring-boot-autoconfigure/2.7.1/spring-boot-autoconfigure-2.7.1.jar]
[Loaded org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication$Type from file:/Users/vixots/.m2/repository/org/springframework/boot/spring-boot-autoconfigure/2.7.1/spring-boot-autoconfigure-2.7.1.jar]
[Loaded org.springframework.boot.autoconfigure.condition.ConditionalOnBean from file:/Users/vixots/.m2/repository/org/springframework/boot/spring-boot-autoconfigure/2.7.1/spring-boot-autoconfigure-2.7.1.jar]
[Loaded org.springframework.boot.autoconfigure.condition.ConditionalOnSingleCandidate from file:/Users/vixots/.m2/repository/org/springframework/boot/spring-boot-autoconfigure/2.7.1/spring-boot-autoconfigure-2.7.1.jar]
[Loaded org.springframework.boot.actuate.audit.AuditEventRepository from file:/Users/vixots/.m2/repository/org/springframework/boot/spring-boot-actuator/2.7.1/spring-boot-actuator-2.7.1.jar]

方法二:直接使用命令行查看,java -verbose:class 进程号

今日诗词