How can I excecute command in java to find the version of the tomcat installed in java programming. I tried using command java -cp .catalina.jar org.apache.catalina.util.ServerInfo but I am unable to understand to give the path of the tomcat installed directory
String line1;
BufferedReader input1;
Process p2 = Runtime.getRuntime().exec(new String[] {
"cmd /c start cmd.exe /K java -cp catalina.jar
org.apache.catalina.util.ServerInfo /s" });
input1 = new BufferedReader(new
InputStreamReader(p2.getInputStream()));
while ((line1 = input1.readLine()) != null) {
System.out.println(line1);
}
input1.close();
I need to print version of the tomcat installed using commands in java