public class Main { public static boolean doesClassExist(String name) { try { Class c = Class.forName(name); if (c != null) return true; } catch (ClassNotFoundException e) { // Class not found } catch (Exception e) { e.printStackTrace(); } return false; } }