Im able to run exe's in runtime via Runtime.getRuntime().exec(filePath), but this only seems to work for external exe's outside of the jar. I want to run an exe that I've packaged inside of the jar. How would I do this? I'd believe theres a jar load function, because I've seen code that loads it the same way using the name of the file in the jar, but that returns an IO error for me.
Asked
Active
Viewed 186 times
1 Answers
1
You can copy it to a temporary location outside the jar file, I think that is possible.

Vinz243
- 9,654
- 10
- 42
- 86
-
1It is indeed possible. Shortest way is probably something like: `Path exe = Files.createTempFile(null, ".exe"); Files.copy(MyApplication.class.getResourceAsStream("/MyProgram.exe"), exe, StandardCopyOption.REPLACE_EXISTING); new ProcessBuilder(exe.toString()).redirectOutput(ProcessBuilder.Redirect.INHERIT).start();` – VGR Aug 17 '13 at 21:22