• Post Reply Bookmark Topic Watch Topic
  • New Topic

how to send command to Command Line?  RSS feed

 
andrei Gourianov
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I simply cannot understand and find how to send a command to Command Line from Java.
OK I can Open DOS:
1. Process p=Runtime.getRuntime().exec("cmd /c start");
2. Now How to "cd C:\" + Enter ?
3. send another command "mvn clean install" + Enter

Thanks
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to JavaRanch. You can not issue more than one command at a time. The alternative is to write a shell script that executes several commands, and to start that using Runtime.exec. And be sure to follow all advice given in this article.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!