Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
355 views
in Technique[技术] by (71.8m points)

java - Passing JVM arguments to Tomcat when running as a service?

I need to pass a couple of JVM arguments to the JVM which Tomcat is running in so that my application can pick them up.

I want to follow the process outlined in this article to pick up environment variables.

How would I go about doing this?

UPDATE Sorry This is running under windows (7 on my Dev machine 2003 on client server)

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Windows:

In your Tomcat /bin folder, you should have a tomcat5w.exe admin app (or in later versions tomcat6w.ex, tomcat8w.exe, etc). Go to the Java tab and add the args in the "Java Options:" box.

enter image description here

Note that when you add new args, you need to add them as NEW LINES in that box (above or below any others there), not as additional arguments IN FRONT or BACK of values on one of the existing lines.

Linux / UNIX:

In *nix, changes to the setenv.sh file should be picked up:

export JAVA_OPTS=-server -Xms2g -Xmx4g -XX:PermSize=64m -XX:MaxPermSize=256m $JAVA_OPTS

Don't touch catalina.sh or other files in bin


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...