如何在eclipse中设置java_opts

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/20253088/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-13 00:36:07  来源:igfitidea点击:

how to set java_opts in eclipse

javaeclipse

提问by CodeMed

I need to set JAVA_OPTSin a development machine running windows 7 home edition and tomcat 7 server. I am getting permgen out of memoryerror when running spring-mvcweb applications from eclipse. I want to enable classunloading so that memory gets freed up over the course of repeated reloading of web applications. I also want to increase the amount of memory available.

我需要JAVA_OPTS在运行 Windows 7 家庭版和tomcat 7 server. permgen out of memory运行spring-mvcWeb 应用程序时出现错误eclipse。我想启用class卸载,以便在重复重新加载 Web 应用程序的过程中释放内存。我还想增加可用内存量。

Can someone show me explicitly how to do this, in step by step form?

有人可以一步一步地明确告诉我如何做到这一点吗?

Do I set a windows system environmental variable? Do I run something from the command line? What specifically will my commands look like in code?

我是否设置了 Windows 系统环境变量?我从命令行运行一些东西吗?我的命令在代码中具体是什么样的?

Here is what I have so far (all on the same line):

这是我到目前为止所拥有的(都在同一行):

JAVA_OPTS=XX:MaxPermSize=128MXX:+CMSClassUnloadingEnabledXX:+CMSPermGenSweepingEnabledXms256m -Xmx512m 

采纳答案by A4L

In eclipse go to your launch configuration of the server (something like Apache Tomcat > Tomcat v7.0 Server at localhost) and add jvm arguments in the Argumentstab in the VM argumentsfield.

在 Eclipse 中,转到服务器的启动配置(类似于Apache Tomcat > Tomcat v7.0 Server at localhost)并ArgumentsVM arguments字段的选项卡中添加 jvm 参数。

If you are using eclipsetotaletomcat plugin then go to

如果您使用的是eclipsetotaletomcat 插件,请转到

Preferences > Tomcat > JVM Settings > Append to JVM Paramaters

and add them one by one.

并一一添加。

EDIT(run as > run on server)

编辑(运行方式 > 在服务器上运行)

enter image description here

在此处输入图片说明