Example usage for java.lang RuntimeException RuntimeException

List of usage examples for java.lang RuntimeException RuntimeException

Introduction

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

Prototype

public RuntimeException(Throwable cause) 

Source Link

Document

Constructs a new runtime exception with the specified cause and a detail message of (cause==null ?

Usage

From source file:Main.java

public static Method getDeclaredMethod(Class<?> clazz, String name, Class<?>... argTypes) {
    try {//from  w ww  .j  a va2s .co  m
        final Method method = clazz.getDeclaredMethod(name, argTypes);
        method.setAccessible(true);
        return method;
    } catch (final SecurityException e) {
        throw new RuntimeException(e);
    } catch (final NoSuchMethodException e) {
        return null;
    }
}

From source file:Main.java

public static File toolsJar() {
    final String jdkLocation = System.getProperty("java.home");
    final File javaHome = new File(jdkLocation);
    try {/*from   ww w  .j  a  v a  2 s . c om*/
        return new File(javaHome, "../lib/tools.jar").getCanonicalFile();
    } catch (final IOException e) {
        throw new RuntimeException(e);
    }
}