Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set JVM arguments in tomcat that work both in eclipse and using the startup.bat

Tags:

I have an installation of Tomcat 7 on windows to which I am deploying my app. I have a couple of JVM args that I need set for the applications running on the server. In searching around on the web I find two (three if you count the windows service) camps:

For those using eclipse:

Double click on the server > Open launch configuration > arguments tab

For those using tomcat's startup script:

Create a setenv.bat (or setenv.sh for Linux) and set either CATALINA_OPTS or JAVA_OPTS

However, they seem to be mutually exclusive. Setting the arguments in eclipse (+1 if you can tell where these are stored) don't affect the startup script and setting the setenv.bat properties don't affect the server when started within eclipse. Both work individually.

Both point to the same installation, and in eclipse on the overview page of the server, I have selected "Use Tomcat installation (takes control of Tomcat installation).

like image 946
Noremac Avatar asked Dec 13 '12 23:12

Noremac


People also ask

Where do I put JVM arguments in Eclipse?

-- Go to the Eclipse Window > preferences, in "Java > Installed JREs". -- Copy the current default JRE with a new name, for example myJRE. -- Select the new JRE and click on the "Edit" button. -- In the "Edit JRE" dialog, add your JVM arguments in the "Default VM Arguments" field.


1 Answers

As I mentioned in the comment above, it looks like the WTP plugins do not call the startup scripts, but directly call on Tomcat through the java executable. Therefore, the VM arguments from eclipse are put directly on the command line, not stored in some config file such as setenv.bat, neither does it read from such a config file from startup. Therefore the two are completely separate in configuration.

like image 179
Noremac Avatar answered Oct 05 '22 15:10

Noremac