Java tutorial
//package com.java2s; //License from project: Open Source License import android.support.annotation.NonNull; public class Main { public static boolean isInClassPath(@NonNull String clsName) { try { return inClassPath(clsName) != null; } catch (Throwable t) { return false; } } public static Class<?> inClassPath(@NonNull String clsName) { try { return Class.forName(clsName); } catch (Throwable t) { throw new IllegalStateException(String .format("%s is not in your class path! You must include the associated library.", clsName)); } } }