I\'m trying to tell the JVM to use my custom ClassLoader as default ClassLoader
This is the VM argument i use to pick my class:
-Djava.system.class.l
Custom ClassLoader
public class CustomClassLoader extends ClassLoader{
public CustomClassLoader(ClassLoader classLoader) {
super(classLoader);
}
@Override
public Class<?> loadClass(String name) throws ClassNotFoundException {
System.out.println("Loading class :" + name);
return super.loadClass(name);
}
}
Main Class
public class Main {
public static void main(String[] args) {
System.out.println("Starting main");
}
}
VM arguments: -Djava.system.class.loader=CustomClassLoader
All classes are in default package and it executes successfully.
Output:
Loading class :Main
Starting main