How to detect tomcat version installed and set CATALINA_HOME env variable using Ant Apache script?

If I understand correctly, you are executing this OS detection from Ant. In that case, can you not instead use Ant's built-in support for OS identification - in the os condition?

If I understand correctly, you are executing this OS detection from Ant. In that case, can you not instead use Ant's built-in support for OS identification - in the os condition? However, if you really need to execute catalina.

Bat while setting CATALINA_HOME, you could do so using a nested env element in you exec task. Here is a sample build file which uses both approaches: Here is the content of test. Bat: echo CATALINA_HOME=%CATALINA_HOME% Here is the output: test: exec exec C:\tmp\ant>echo CATALINA_HOME=whatever exec CATALINA_HOME=whatever echo os.

Arch: x86 echo os. Name: Windows XP echo os. Version: 6.1 build 7601 Service Pack 1 echo is.

Windows? True Regarding your subsequent question (in comments) about tomcat version... I now guess you are executing this version detection via Ant in your runtime environment. Ant and Java don't know about your Tomcat environment, so now you're back to executing %CATALINA_HOME%\bin\catalina.

Bat -version and parsing what you need from the output. Here's a working example: And here is the output: version: echo tomcat. Version: 5.5.33 Note that this example assumes that you have the CATALINA_HOME (and JAVA_HOME) environment variable set in your terminal.

Alternatively, you could pass these variables using a nested element as previously discussed. But it seems more likely that these should come from the runtime environment rather than embedded in your build file.

What does the three dots signify here... – user1037728 Nov 14 at 11:08 and does this set system environment variable in Windows and UNIX – user1037728 Nov 14 at 11:27 I want to catch version of the OS and OS condition just tells its windows – user1037728 Nov 14 at 11:44 Problem: failed to create task or type env Cause: The name is undefined. Action: Check the spelling. Action: Check that any custom tasks/types have been declared.

Action: Check that any / declarations have taken place. I got this error – user1037728 Nov 14 at 11:54 The ... was just placeholder for whatever attributes you actually apply to your exec task. – sudocode 28 Nov7 at 13:44.

Do it like this : ... execute your script here.

– user1037728 Nov 14 at 11:59 NO OUTPUT IN ECHO – user1037728 Nov 14 at 11:59 @user1037728 No idea what you are doing there. – FailedDev Nov 14 at 12:01.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions