Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 753
David Avatar asked Dec 31 '10 18:12

David


1 Answers

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

Desktop.getDesktop().open(file);
like image 51
BalusC Avatar answered Oct 08 '22 14:10

BalusC