Running an executable command in Java with parameters?
问题 So i understand how to use the Runtime command in java pretty well to get an executable to run. My question is how would i code that to incorporate a parameter such as you would see in the target in a shortcut property, i.e. target: "C:......\notepad.exe" -w. In what way could I incorporate a parameter such as -w into the Java runtime command. 回答1: Use a ProcessBuilder and supply the necessary arguments to its constructor: ProcessBuilder builder = new ProcessBuilder("C:\\path\\to\\notepad.exe