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 deleted file mode 100644 index 2574394c13..0000000000 --- a/core-java-modules/core-java-jvm-2/src/main/java/com/baeldung/loadedclasslisting/customLoader/ClassLoaderInfo.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.baeldung.loadedclasslisting.customLoader; - -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()); - } -} diff --git a/core-java-modules/core-java-jvm-2/src/main/java/com/baeldung/loadedclasslisting/customLoader/CustomClassLoader.java b/core-java-modules/core-java-jvm-2/src/main/java/com/baeldung/loadedclasslisting/customLoader/CustomClassLoader.java deleted file mode 100644 index a5f293f605..0000000000 --- a/core-java-modules/core-java-jvm-2/src/main/java/com/baeldung/loadedclasslisting/customLoader/CustomClassLoader.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.baeldung.loadedclasslisting.customLoader; - -import java.io.ByteArrayOutputStream; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; - -public class CustomClassLoader extends ClassLoader { - - @Override - public Class findClass(String name) throws ClassNotFoundException { - byte[] b = loadClassFromFile(name); - return defineClass(name, b, 0, b.length); - } - - private byte[] loadClassFromFile(String fileName) { - InputStream inputStream = getClass().getClassLoader() - .getResourceAsStream(fileName.replace('.', File.separatorChar) + ".class"); - byte[] buffer; - ByteArrayOutputStream byteStream = new ByteArrayOutputStream(); - int nextValue = 0; - try { - while ((nextValue = inputStream.read()) != -1) { - byteStream.write(nextValue); - } - } catch (IOException e) { - e.printStackTrace(); - } - buffer = byteStream.toByteArray(); - return buffer; - } -}