Reputation: 331
What i need is to accept a path (via args) to a mongod.cfg file and use it to start mongod from java. This is whar i am using
Runtime.getRuntime().exec("cmd /k start mongod --config C:\\Users\\Ivan\\git\\StudentsDBMS_Server\\StudentsDBMS_Server\\mongod.bat");
On removing start command it does not runs the command. Also can you explain why does it prints the command infinitely but does not execute anyone of them.
Please
Upvotes: 0
Views: 86
Reputation: 331
Thank You MC ND and Riv, The final command i used is
Runtime.getRuntime().exec("cmd /k start mongod --config \"C:\\Users\\pebble\\git\\StudentsDBMS_Server\\StudentsDBMS_Server\\mongod.cfg\"");
and i renamed mongod.bat to mongoServer.bat
Upvotes: 1
Reputation: 357
Maybe the cmd syntax is off. Try like this maybe:
'cmd /k "start mongod --config C:\\Users\\Ivan\\git\\StudentsDBMS_Server\\StudentsDBMS_Server\\mongod.bat"'
Upvotes: 0