buffer.save(view, null, true); VFSManager.waitForRequests(); path = buffer.getPath(); workdir = (new File(path)).getParentFile(); path = "\"" + path + "\""; /* runtime = Runtime.getRuntime(); runtime.exec("rundll32 SHELL32.DLL,ShellExec_RunDLL " + path, null, workdir); */ pb = new ProcessBuilder(new String [] { "cmd", "/c", "rundll32", "SHELL32.DLL,ShellExec_RunDLL", "%FOO%"}); pb.directory(workdir); env = pb.environment(); env.putAll(System.getenv()); env.put("FOO", path); pb.start();