Example usage for java.lang ClassNotFoundException printStackTrace

List of usage examples for java.lang ClassNotFoundException printStackTrace

Introduction

In this page you can find the example usage for java.lang ClassNotFoundException printStackTrace.

Prototype

public void printStackTrace() 

Source Link

Document

Prints this throwable and its backtrace to the standard error stream.

Usage

From source file:Main.java

public static Class<?> loadPluginClass(ClassLoader classLoader, String className)
        throws ClassNotFoundException {
    Class<?> clazz;//from w ww  . ja va  2 s.c  om
    try {
        clazz = Class.forName(className, true, classLoader);
    } catch (ClassNotFoundException e) {
        e.printStackTrace();
        throw e;
    }

    return clazz;
}

From source file:Main.java

public static Object getObjectByClasspath(String classpath) {
    Object object = null;//from   w  ww  . ja  v  a2s  .  c om
    try {
        Class clazz = Class.forName(classpath);
        object = clazz.newInstance();
    } catch (ClassNotFoundException e) {
        e.printStackTrace();
    } catch (InstantiationException e) {
        e.printStackTrace();
    } catch (IllegalAccessException e) {
        e.printStackTrace();
    }
    return object;
}

From source file:Main.java

public static Class<?> getKlass() {
    if (bluetoothPan == null) {
        try {//from  ww  w.jav a 2 s.  c o m
            bluetoothPan = Class.forName(CLASS_NAME);
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }
    }

    return bluetoothPan;
}

From source file:Main.java

private static void addClassName(List<Class<?>> clazzList, String clazzName) {
    if (clazzList != null && clazzName != null) {
        Class<?> clazz = null;
        try {//from  w w  w  .  j av a2 s  . com
            clazz = Class.forName(clazzName);
            clazzList.add(clazz);
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }
    }
}

From source file:Main.java

public static boolean isClassAvailable(String className) {

    try {//w  w  w .  j  a  v a2  s  .  com

        Class.forName(className);
    } catch (ClassNotFoundException e) {

        e.printStackTrace();
        return false;
    }

    return true;
}

From source file:Main.java

public static Class<?> getClass(String className) {
    try {/*from  w w w  . j av  a2  s. c om*/
        return Class.forName(className);
    } catch (ClassNotFoundException e) {
        e.printStackTrace();
    }
    return null;
}

From source file:Main.java

public final static boolean setClass(String name) {
    Class<?> tmpClass = null;
    try {//from   w  w w  . ja  v a 2  s.c om
        tmpClass = Class.forName(name);
    } catch (ClassNotFoundException e) {
        e.printStackTrace();
    } catch (ExceptionInInitializerError e) {
        e.printStackTrace();
    } catch (LinkageError e) {
        e.printStackTrace();
    }

    sCurrentClass = tmpClass;
    return tmpClass != null;
}

From source file:Main.java

/**
 * From the name of the class returns the class.
 * /*from www. ja  va 2s.  c o m*/
 * @param data
 *            The name for class
 * @return the class or null
 */
public static Class<?> returnClass(final String data) {
    Class<?> clazz = null;
    try {
        clazz = Class.forName(data);
    } catch (final ClassNotFoundException e) {
        e.printStackTrace();
    }
    return clazz;
}

From source file:Main.java

/**
 * Get {@link AssetManager} using reflection
 *//*w ww  . j av a 2s. c om*/
private static Object getAssetManager() {
    Class assetManagerClass = null;
    try {
        assetManagerClass = Class.forName("android.content.res.AssetManager");
        return assetManagerClass.newInstance();
    } catch (ClassNotFoundException e) {
        e.printStackTrace();
    } catch (InstantiationException e) {
        e.printStackTrace();
    } catch (IllegalAccessException e) {
        e.printStackTrace();
    }

    return null;
}

From source file:Main.java

@SuppressWarnings("unchecked")
public static List<Object> loadEnums(List<String> classFullNameList) {
    Class aeClass = null;//  w w  w.ja va2  s  . co  m
    List<Object> retList = new ArrayList<Object>();
    for (String aeString : classFullNameList) {
        try {
            aeClass = Class.forName(aeString);
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }
        for (Object ae : EnumSet.allOf(aeClass)) {
            retList.add(ae);
        }
    }
    return retList;
}