# Can catalina.bat change environment variables?

I inherit the project and (according to other developer instructions) rewrote my version of Tomcat `catalina.bat`

with my own (it uses the same version). Then I tried to restart Tomcat and got an exception related to `commons-logging.jar`

which is a Tomcat dependency.

After many frustrations, I just downloaded a different version of Tomcat and tried to run it right out of the box (no configuration) ... and I got the same error!

So, I asked this question on SO a few days ago. The consensus was that my classpath somehow got "dirty" and now I'm wondering if the file `catalina.bat`

I blindly copied somehow set environment variables that affect Tomcat's ability to download files - even across different versions ...

I know this question is similar to the other I asked, but different. While my first question was "what's wrong here" and was much more general, what I'm asking now (albeit related) is more specific and refers to `catalina.bat`

and applies to Windows 7 environment variables.

Thanks for any help here.

Edit . I see that this question already has a close approach to being "off topic". My argument against this is this: SO is a Programming Q&A Site for asking specific questions related to code and programming. `catalina.bat`

is a script that is a code and this question is about the very potential error / defect in the script I'm using.

Edit . Look for the line in `catalina.bat`

where the error message comes from (and also where Tomcat startup dies from). This is the line (from version 7.0.19 unchanged):

% _ EXECJAVA %% JAVA_OPTS %% CATALINA_OPTS %% DEBUG_OPTS% -Djava.endorsed.dirs = "% JAVA_ENDORSED_DIRS%" -classpath "% CLASSPATH%" -Dcatalina.base = "% CATALINA_BASEAL.homeAcatalina% % "-Djava.io.tmpdir ="% CATALINA_TMPDIR% "% MAINCLASS %% CMD_LINE_ARGS %% ACTION%

I was able to place `echos`

in a script and got the following values:

``````JAVA_OPTS = -Djava.util.logging.config.file="C:\Program Files\Apache\apache-to
mcat-7.0.19\conf\logging.properties" -Djava.util.logging.manager=org.apache.juli
CATALINA_OPTS =
DEBUG_OPTS =
JAVA_ENDORSED_DIRS = C:\Program Files\Apache\apache-tomcat-7.0.19\endorsed
CLASSPATH = C:\Program Files\Apache\apache-tomcat-7.0.19\bin\bootstrap.jar
CATALINA_BASE = C:\Program Files\Apache\apache-tomcat-7.0.19
CATALINA_HOME = C:\Program Files\Apache\apache-tomcat-7.0.19
CATALINA_TMPDIR = C:\Program Files\Apache\apache-tomcat-7.0.19\temp
MAINCLASS is org.apache.catalina.startup.Bootstrap
CMD_LINE_ARGS =
ACTION = start
```

```

JAVA_OPTS draws my attention to entries `logging.properties`

and `ClassLoaderLogManager`

. Does this mean anything to anyone?!?

+3

source to share

you can set environment variables in any batch file including catalina.bat. However, these changes only remain in the current production environment and will not affect all other running environments.

For CLASSPATH, look in the appropriate batch files if you see something like `set CLASSPATH=`

that gives you information about the set classpath.

+2

source

Looking at the previous answers in another question, it looks like the consensus is that the class path has become "dirty". But rather, the Tomcat installation itself has gotten messy, a mixture of several different Tomcat versions.

Please note that Tomcat does not use the values ​​from yours by default in `CLASSPATH`

order to avoid such problems. You have to examine the file your colleague gave you to see what exactly he changed in it (given that you can script anything into a BAT file, it's almost impossible to pinpoint the exact problem based on the description you provided).

Good luck.

+1

source

All Articles