Actually i have to restart the weblogic server, when i click a button on my jsp page. So, I wanted to execute stopWeblogic.cmd and startWeblogic.cmd from the code.
How to do this?
-------------------- <br />SCJP 1.4<br />SCWCD 1.4<br />SCBCD 5(in progress)<br /> <br />"Do, what you think that you cannot do"
Originally posted by navat venu: How to execute a cmd file from the java code?
Actually i have to restart the weblogic server, when i click a button on my jsp page. So, I wanted to execute stopWeblogic.cmd and startWeblogic.cmd from the code.
How to do this?
try{ Process process1 = Runtime.getRuntime().exec("\\directoryPath \\stopWeblogic.cmd"); }catch(Exception e){};
Judge a man by his questions rather than his answers --Voltaire
SCJP 1.5 97%
in This article talks about what you need to watch out for when using Runtime.exec, especially the handling of the I/O streams.
I could imagine there being problems with this approach, since you're trying to kill the server that executes the command. That's just a hunch, though.