class doInit implements PrivilegedAction { public Object run() { nm = new NetworkMonitor(); return nm; } } doInit di = new doInit(); AccessController.doPrivileged(di);