Reputation: 896
I have jar file(selenium-server-standalone-2.44.0.jar) kept at c:\ drive. I need to navigate to C drive and execute below command through java
java -jar selenium-server-standalone-2.44.0.jar -role hub
Upvotes: 0
Views: 7952
Reputation: 6248
You can try below code
Process process = Runtime.getRuntime().exec("cmd /c start cmd.exe /K java -jar selenium-server-standalone-2.44.0.jar -role hub");
However this will run executable jar from your current directory, where you .class file exist.
Upvotes: 3