cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
vijji123
Level 6

Starting tomcat using Execute Script/batch file action

Hi I have a requirement where i need to start and stop tomcat from command prompt rather than using windows service.

I am using the below code using Execute Script/batch file action

cd $PORTAL_HOME$\bin
catalina.bat start

but it is failing to start.

Second question is if it get started how can we suspend the installer progress untill server get started.

Thanks,
Vijay
Labels (1)
0 Kudos
(2) Replies
pv7721
Level 20

I think that this has to do with the fact that when you do that the startup.bat opens a new window, and "Suppress first window" (Windows only) is checked by default. However, I really don't see the use case of starting the Apache Tomcat server not by service, but by this .bat file, exactly because of this console window...
0 Kudos
Scorp84
Level 3

I made a setup that does exactly what you need. I made it in an CustomCodeAction. Here's the Code:


File scriptFile = new File("C:\\TOMCAT\\catalina.bat"); //whatever your path is

ProcessBuilder oProcBuilder = neww ProcessBuilder("cmd", "/c", scriptFile.getName());

oProcBuilder.directory(scriptFile.getParentFile());


//run the script file
try {
Process oProcScript = oProcBuilder.start();

try {
oProcScript.waitFor();
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

} catch (IOException e) {
e.printStackTrace();
}


0 Kudos