Skip to content

Instantly share code, notes, and snippets.

@gonejack
Created August 8, 2017 06:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gonejack/8076b09b92cb2e639a14306d5e942bac to your computer and use it in GitHub Desktop.
Save gonejack/8076b09b92cb2e639a14306d5e942bac to your computer and use it in GitHub Desktop.
public class MainClass {
public static void main(String[] args){
ClassLoader classLoader = MainClass.class.getClassLoader();
try {
Class aClass = classLoader.loadClass("com.jenkov.MyClass");
System.out.println("aClass.getName() = " + aClass.getName());
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment