Here you can find the source of runInNewThread(String threadName, Runnable target)
public static void runInNewThread(String threadName, Runnable target) throws Throwable
//package com.java2s; // This software is released under the Apache License 2.0. import java.util.concurrent.*; public class Main { public static void runInNewThread(String threadName, Runnable target) throws Throwable { FutureTask<Object> future = new FutureTask<Object>(target, null); new Thread(future, threadName).start(); try {/*from w w w. j a v a 2s. c o m*/ future.get(); } catch (ExecutionException e) { throw e.getCause(); } } }