I'm running a program as follows:
Runtime.getRuntime().exec("C:\meuprograma.exe");
In which it works normally. But I would like to package the files (the executable and some more) inside my project so the user does not have to be manipulating the files. What's more, the file is important only at runtime, so there's no need for me to create a directory to "install" the required files (unless that's the only solution, of course). I've created a structure similar to this:
src
|__ br.foo.files
|__ br.foo.main
Assuming my class that will call the executable is inside the main
package, how do I execute a file inside the files
package? I tried:
Runtime.getRuntime().exec("files/meuprograma.exe");
Runtime.getRuntime().exec("./files/meuprograma.exe");
Runtime.getRuntime().exec("/files/meuprograma.exe");
In which all generated the following exception:
Exception in thread "main" java.io.IOException: Can not run program "files / meuprograma.exe": CreateProcess error = 2, The system can not find the specified file