|
How to start Tomcat at runtime from Java class |
|
|
The package java.lang provides the Runtime class to execute commands as
separate processes at runtime. The example below starts tomcat from a java class:
import java.io.*;
class test
{
public static void main(String[] args)
{
try
{
Runtime r = Runtime.getRuntime();
Process p = r.exec("D:\\Program Files\\Tomcat\\bin\\tomcat5.exe");
DataInputStream i = (DataInputStream)p.getInputStream();
while(i.readLine() !=null)
{
i.read();
}
}
catch (Exception e)
{
}
}
}
|
Related Tips
|
Page 1 of 0 ( 0 comments )
You can share your information about this topic using the form below!
Please do not post your questions with this form! Thanks.