Java tutorial
//package com.java2s; //License from project: Open Source License public class Main { /** runs as a daemon (will not keep JVM running). */ public static Thread runAsThread(Runnable runnable) { return runAsThread(runnable, true); } public static Thread runAsThread(Runnable runnable, boolean daemon) { Thread thread = new Thread(runnable); thread.setDaemon(daemon); thread.start(); return thread; } }