• Post Reply Bookmark Topic Watch Topic
  • New Topic

Runtime.getRuntime().exec() execute two lines?  RSS feed

 
Gynnad Paullussen
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello All,

I need to run two lines in Runtime.getRuntime().exec(), this two:

cd %CMS_HOME% and ant deploy

Now is it possible to make a .bat file, but I think it is useless for two lines,
is muss be easier! Someone any idea?
 
Rob Spoor
Sheriff
Posts: 21133
87
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Both Runtime.exec and ProcessBuilder allow you to specify the working directory. Set that to the value of CMS_HOME and execute the command. You can resolve CMS_HOME using System.getenv.
 
Gynnad Paullussen
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rob Spoor wrote:Both Runtime.exec and ProcessBuilder allow you to specify the working directory. Set that to the value of CMS_HOME and execute the command. You can resolve CMS_HOME using System.getenv.


process = Runtime.getRuntime().exec("cmd /"+ System.getenv("CMS_HOME") +" start ant deploy");

this isn't working for me..
 
Rob Spoor
Sheriff
Posts: 21133
87
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's nowhere near what I said. Did you even check the Javadoc for Runtime.exec? Did you see it's overloaded?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!