I need to execute a .exe file from a function in one of the packages I have in my java project. now the working directory is the root directory of the project for java but t
I goted a same problem in my project, I tryed this solutions about ProcessBuilder.directory(myDir)
and the exec method from Runtime
and all my trays failed..
It's make me understanding that the Runtime
have a limited privileges just for the working directory and the sub directories of it.
So my solution is ugly but working very well.
I create a temporary .bat file in "runtime" in the working directory.
This file included two lines of commands:
1. Move to needed directory (cd command).
2. Do the command in need.
I call the exec from Runtime
with my temporarily .bat file as command.
It's work for me very well!