why System.getenv("CATALINA_HOME") returns null?
Possible reasons:
You've used
set CATALINA_HOME
in a command prompt. That makes this variable local to this window. It should be visible to processes started from this command prompt but nowhere else. UseMy Computer > Advanced > Environment Variables
to make a variable visible to all new processes.The process which tries to read the variable is already running. Restart it. (it applies to an IDE running java which needs to be restarted, or the java process to be restarted).
The start script of Tomcat unsets the variable before it invokes
java.exe
Tomcat unsets the variable in it's Java code.
If method system.getenv("some name")
return null
probably you define this variable in your environment after lunching your Eclipse IDE. Just restart your Eclipse and then run your project again.