How to use a System.getProperty() for an application running on Tomcat
java, tomcat
Solution
After some hit and trial, placed `name=rickesh` in `catalina.properties` present in `C:\apache-tomcat-6.0.35\conf`. Works fine.
Problem
I am trying to set a system property and retrieve it in my Servlet. ``` protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { System.out.println(System.getProperty("name")); } ``` I placed this: `-Dname=rickesh` in CATALINA_OPTS but running the code returns `null`. I have no idea as to how I can pass parameters to Tomcat at runtime and use it via `System.getProperty(String)`. A Google Search to do the same suggests to do a JNDI or set in CATALINA_OPTS, but no example on how to set either. Please advice.