Tomcat – why CATALINA_OPTS arguments shows up in java process on running tomcat even though its an environment variable

javatomcat

I run tomcat process by this command in python :

os.execve(cmd, [cmd, "run"], env)

The env variable sets CATALINA_OPTS = -server -Xms512m -Xmx512m -Xss512k
Now when i run the script following java process is shown in ps output :

java -server -Xms512m -Xmx512m -Xss512k org.apache.catalina.startup.Bootstrap start

My question is why CATALINA_OPTS getting shown up in ps output of java process even though CATALINA_OPTS is an environment variable?

Best Answer

Typically the catalina.sh script is invoked via a wrapper as a sysvinit script. It loads the environment variable and uses it as an argument to the java process that ultimately calls tomcat.