file - Open and close applications from Java -
i want make program open , close applications have installed on computer.
i know using
runtime.getruntime().exec("rundll32 shell32.dll,shellexec_rundll "+"m:\\myfile.doc");
open word document myfile.doc
the problem using command can not close word application opens when execute command.
how can open , close applications java program?
thank's!
regards!
you try storing process
returned exec()
, calling destroy()
on don't think work since executing windows command launches new process not managed jvm (only rundll32 thing seen jvm).
a solution work sure won't cross-platform (i don't think care since word not cross-platform :) use windows shell command obtain want,
taskkill /im word.exe
you execute in same way open word, defaultruntime.exec(...)
. if have many word processes opened , want kill specific 1 have parse task list obtain correct pid , try taskkill /pid xxxx
.
Comments
Post a Comment