I have a C code which I have compiled and added to path in order to be able to execute it form anywhere (I've double checked that I can do that)
Now I want to do a GUI to work with it in an easier way. I ask the user to input a file and an output directory.
In a click button I put the code to execute the command from the GUI:
String command = "myprogram -e " + file;
new ExecuteShellInstruction().main(command,jTextOutputDirectory.getText());
I execute the code in other class:
p = Runtime.getRuntime().exec(command, null, new File(directory));
But I always get this error:
java.io.IOException: Cannot run program "myprogram" (in directory "/Users/user_name/Documents/folder/example"): error=2, No such file or directory
I've checked that if I write exactly the same from the same folder there is no problem.
Any idea of what I'm doing worng?, If obtained this way of doing it from a question which was marked as correct, maybe I'm missing something, but I've already been 1 hour trying things and nothing seems to work.
Thank you!