I'm unsure how to start an external application (specifically on Windows) through Java code. I'm not planning on using this Java code for Mac/Linux, so let's focus on the Windows code.
What I've Done
I've been researching this question for the last two days, and I still have not found an answer. I easily found the Runtime.getRuntime().exec()
method, but the thing is I cannot find information on launching a Batch (.bat) file from my local workspace in IntelliJ Idea.
What I'm Asking
I would just like to know how to execute a local Batch file in my workspace (at a folder like com.example.batch
) and/or how to execute a (.exe) or (.bat) with the direct file address. (For example the Defragment and Optimize Drives (.exe) for Windows: C:\WINDOWS\system32\dfrgui.exe
)
Thanks to all in advance, I've been dying for this answer.