diff --git a/core-java-modules/core-java-jvm-2/src/main/java/com/baeldung/loadedclasslisting/ClassLoaderType.java b/core-java-modules/core-java-jvm-2/src/main/java/com/baeldung/loadedclasslisting/ClassLoaderType.java deleted file mode 100644 index 1111fc21fe..0000000000 --- a/core-java-modules/core-java-jvm-2/src/main/java/com/baeldung/loadedclasslisting/ClassLoaderType.java +++ /dev/null @@ -1,6 +0,0 @@ -package com.baeldung.loadedclasslisting; - -public enum ClassLoaderType { - - SYSTEM, EXTENSION, BOOTSTRAP, CUSTOM -} diff --git a/core-java-modules/core-java-jvm-2/src/main/java/com/baeldung/loadedclasslisting/Launcher.java b/core-java-modules/core-java-jvm-2/src/main/java/com/baeldung/loadedclasslisting/Launcher.java index 19c42dfd8d..e1851275c9 100644 --- a/core-java-modules/core-java-jvm-2/src/main/java/com/baeldung/loadedclasslisting/Launcher.java +++ b/core-java-modules/core-java-jvm-2/src/main/java/com/baeldung/loadedclasslisting/Launcher.java @@ -3,6 +3,7 @@ package com.baeldung.loadedclasslisting; import java.lang.reflect.Method; import java.util.Arrays; +import com.baeldung.loadedclasslisting.ListLoadedClassesAgent.ClassLoaderType; import com.baeldung.loadedclasslisting.customLoader.ClassLoaderInfo; import com.baeldung.loadedclasslisting.customLoader.CustomClassLoader; @@ -11,13 +12,9 @@ public class Launcher { private static ClassLoader customClassLoader; public static void main(String[] args) { - printClassesLoadedBy(ClassLoaderType.BOOTSTRAP); - printClassesLoadedBy(ClassLoaderType.SYSTEM); - printClassesLoadedBy(ClassLoaderType.EXTENSION); - printClassesLoadedBy(ClassLoaderType.CUSTOM); } diff --git a/core-java-modules/core-java-jvm-2/src/main/java/com/baeldung/loadedclasslisting/ListLoadedClassesAgent.java b/core-java-modules/core-java-jvm-2/src/main/java/com/baeldung/loadedclasslisting/ListLoadedClassesAgent.java index 03907f8b04..8f4b8ebd41 100644 --- a/core-java-modules/core-java-jvm-2/src/main/java/com/baeldung/loadedclasslisting/ListLoadedClassesAgent.java +++ b/core-java-modules/core-java-jvm-2/src/main/java/com/baeldung/loadedclasslisting/ListLoadedClassesAgent.java @@ -4,6 +4,10 @@ import java.lang.instrument.Instrumentation; public class ListLoadedClassesAgent { + public enum ClassLoaderType { + SYSTEM, EXTENSION, BOOTSTRAP, CUSTOM , PLATFORM + } + private static Instrumentation instrumentation; public static void premain(String agentArgs, Instrumentation instrumentation) { diff --git a/core-java-modules/core-java-jvm-2/src/main/java/com/baeldung/loadedclasslisting/customLoader/ClassLoaderInfo.java b/core-java-modules/core-java-jvm-2/src/main/java/com/baeldung/loadedclasslisting/customLoader/ClassLoaderInfo.java index a787b062d5..2574394c13 100644 --- a/core-java-modules/core-java-jvm-2/src/main/java/com/baeldung/loadedclasslisting/customLoader/ClassLoaderInfo.java +++ b/core-java-modules/core-java-jvm-2/src/main/java/com/baeldung/loadedclasslisting/customLoader/ClassLoaderInfo.java @@ -5,7 +5,6 @@ import java.util.ArrayList; public class ClassLoaderInfo { public void printClassLoaders() throws ClassNotFoundException { - System.out.println("Classloader of this class:" + ClassLoaderInfo.class.getClassLoader()); System.out.println("Classloader of ArrayList:" + ArrayList.class.getClassLoader()); }