How to execute a java program with the help of Runtime.getRuntime().exec(). For example we shall have the java file path as c:/java/abc.java. Please help me with the code.
Assuming that abc.java contains a main method that you want to execute:
Runtime.getRuntime().exec("javac c:\java\abc.java -d c:\java\")
Runtime.getRuntime().exec("java c:\java\abc")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With