Java的Runtime.getRuntime()。exec()会在Windows 7上运行吗?

时间:2010-12-31 18:10:16

标签: java windows windows-7

我有windows xp并开发了一些java swing应用程序 在我的程序中,我正在使用

Runtime.getRuntime().exec("rundll32 SHELL32.DLL,ShellExec_RunDLL "+ myfile);

在Windows默认编辑器中打开我的程序生成的文件。

它在我的系统上运行正常。我只是想知道它在Windows 7上是否正常。
Windows 7中的流程执行是否有任何安全方面,而这些方面没有出现在Windows XP中?

1 个答案:

答案 0 :(得分:9)

不是直接的答案,但您应该使用Desktop#open()来实现这一点。

Desktop.getDesktop().open(file);