如何在Tomcat中设置在eclipse和使用startup.bat中都可以使用的JVM参数 [英] How to set JVM arguments in tomcat that work both in eclipse and using the startup.bat

查看:186
本文介绍了如何在Tomcat中设置在eclipse和使用startup.bat中都可以使用的JVM参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在将应用程序部署到的Windows上安装了Tomcat 7。我需要为服务器上运行的应用程序设置几个JVM参数。在网上搜索时,我发现了两个(如果算上Windows服务,则是三个)阵营:



对于使用eclipse的人:



双击服务器>打开启动配置>参数选项卡



对于使用tomcat启动脚本的用户:



创建一个setenv.bat(或Linux的setenv.sh)并设置CATALINA_OPTS或JAVA_OPTS



<但是,它们似乎是互斥的。在eclipse中设置参数(如果可以告诉它们存储在哪里,则为+1)不会影响启动脚本,而在eclipse中启动时,设置setenv.bat属性也不会影响服务器。两者都可以单独工作。



两者都指向相同的安装,并且在服务器概述页面的eclipse中,我选择了使用Tomcat安装(控制Tomcat安装) )。

解决方案

正如我在上面的评论中提到的,看起来WTP插件不调用启动脚本,而是直接调用启动脚本通过java可执行文件在Tomcat上调用Tomcat,因此,eclipse中的VM参数直接放在命令行上,而不是存储在诸如setenv.bat之类的配置文件中,也不从启动时从这样的配置文件中读取。在配置上完全分开。


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).

解决方案

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.

这篇关于如何在Tomcat中设置在eclipse和使用startup.bat中都可以使用的JVM参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆