i have the situation like this Runtime r=Runtime.getRuntime(); Process p=r.exec("cmd /c start d:/bea/weblogic700/server/bin/setWLSEnv.cmd") now it is working.what i have to do is for this setWLSEnv.cmd i have tpass parameters java -Dweblogic.Doamin=mydomain -Dweblogic.Name =servername weblogic.Server.when i gave this command weblogicserver should start automatically with specified domainname and servername.can we passlike this below String s= -Dweblogic.Domain=mydomain -Dweblogic.Name=myserver Process p=r.exec("cmd /c start d:/bea/weblogic700/server/bin/setWLSEnv.cmd j java s"); when i gave this command weblogicserver should start automatically with the specified domainname and servername.please tellme how to do this
Joined: Aug 05, 2005
Thanks Jesper. I must get my eyes tested. I was sure there was a dot and not a space between mydomain and weblogic.Server
trinadh - try
or, even better, take a look at the version of exec that takes an array of Strings as an argument. It makes the code a lot easier to read when you have a long command line.
Joined: Sep 22, 2005
Process p=r.exec("cmd /c start d:/bea/weblogic700/server/bin/setWLSEnv.cmd java "+s); i have tried like this also. no output is comming when iam trying to use streams here InputStream is=p.getInputStream(); it is not writing any data to the stream
In my opinion, you should write a batch file or a shell script (depending on the operating system) that does this. You should use the correct tool for the job, and in my opinion, Java isn't the correct tool in this case.