I want to run and pass the arguments to ".cmd" file using Java program. I have checked the existing Solutions, but nothing is working in my case.
From Command line, I am running below command after getting into Directory C:/users/project/solr/bin
solr.cmd -s "C:users/github/example/solr-config"
So, solr.cmd
gets arguments from the other Directory and then it runs the solr instance.
I have tried this, but I am not sure how to provide Parameters to Runtime.getRuntime()
:
Runtime run = Runtime.getRuntime();
Process p = null;
String cmd = "cmd /c start C:/users/project/solr/bin C:users/github/example/solr-config";
Process pr = run.exec(cmd);
I have followed this link: How do I run a batch file from my Java Application?
Could anyone please help me this.