would Java's Runtime.getRuntime().exec() run on windows 7?

試著忘記壹切 提交于 2019-12-07 02:35:44

问题


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?


回答1:


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

Desktop.getDesktop().open(file);


来源:https://stackoverflow.com/questions/4571604/would-javas-runtime-getruntime-exec-run-on-windows-7

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!