Hi everybody !
Question No.1
I want to call some *.sh files from my java application. Is it possible? I have done that in Windows with batch files but unable to do in Solaris and Linux with *.sh files.
Question No.2
I'm launching my Web Application as NT Service in Windows. Is there any way in Solaris and Linux to do the same? I know there are some daemons which can do the same. But I dont know how use/handle them.
The sample code for Windows to call batch file
====================================
public static boolean callBatchFile(String a_strFilePath) {
try {
System.out.println("Running the batch script");
System.out.println("Batch File Path..: " + a_strFilePath);
Process tomcat = Runtime.getRuntime().exec("cmd /c start /MIN " +
a_strFilePath);
tomcat.waitFor();
System.out.println("Finished running the batch script");
return true;
}
catch (Exception ex) {
ex.printStackTrace();
return false;
}
}
Sample Code of batch to start my application as NT Service.
%SystemRoot%\system32\net start myWebApp
exit