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

发布于 2024-10-10 01:30:15 字数 278 浏览 0 评论 0原文

我有 Windows XP 并开发一些 java swing 应用程序。
在我的程序中,我使用

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

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

它在我的系统上运行良好。我只是想知道它在 Windows 7 上是否可以正常工作。
Windows 7 中的此进程执行是否存在 Windows XP 中未显示的安全问题?

i have windows xp and developing some java swing application.
In my program i am using

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

to open the file produced from my program in windows default editor.

It works fine on my system. I just want to know would it work OK on windows 7.
Are there any security aspects to this process execution in windows 7 which does not show up in windows XP?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

香橙ぽ 2024-10-17 01:30:15

不是直接答案,但您应该使用 Desktop#open() 使其与平台无关。

Desktop.getDesktop().open(file);

Not a direct answer, but you're supposed to use Desktop#open() for this to be platform independent.

Desktop.getDesktop().open(file);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文