package az.mm.runnable; import java.io.IOException; public class Controller { public static void main(String[] args) { Service service = new Service(); service.sendMessage(); } } class Service { void sendMessage() { Runnable runnable = new Runnable() { @Override public void run() { try { throw new IOException(); } catch (IOException ex) { // throw ex; // compile error throw new RuntimeException(ex); } } }; Thread thread = new Thread(runnable); thread.start(); } }