0

Im just looking for function that can run some .exe files But I didn't find that function in Java ShellExecute(Operation, File, Parameters, Directory, ShowCmd : String) is there a function like that?

1 Answers1

1

java.awt.Desktop provides some of that functionality:

  • browse can be used to open the default browser for a specific URI
  • open opens a file for viewing (with the default viewer of the OS)
  • edit opens a file for editing (with the default editor of the OS)
  • ...

If you want to run arbitrary exe files, however, then Runtime.exec is the way to go (but using it can be tricky, as you need to consume all streams for it to not lock up).

Joachim Sauer
  • 302,674
  • 57
  • 556
  • 614
  • Yep but anyway I find out these function useful so thanks for the answer –  Apr 29 '20 at 13:40