使用 IntelliJ 或 Play 时,如何使“Java Hot Spot MaxPermSize”警告消失?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/24706544/
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
How do I make the "Java Hot Spot MaxPermSize" warning go away when using IntelliJ or Play?
提问by W.P. McNeill
I get this warning when I launch IntelliJ or run play
in a Playproject.
当我启动 IntelliJ 或play
在Play项目中运行时,我收到此警告。
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=512M; support was removed in 8.0
How do I make it go away?
我该如何让它消失?
The answerto the same question for Maven says to remove MaxPermSize
option from the MAVEN_OPTS
environment variable. I don't have a MAVEN_OPTS
variable set on my machine. I imagine there is some similar sbt setting, but I don't know where it is.
Maven 的同一问题的答案是MaxPermSize
从MAVEN_OPTS
环境变量中删除选项。MAVEN_OPTS
我的机器上没有设置变量。我想有一些类似的 sbt 设置,但我不知道它在哪里。
I see lots of explanationsabout what the change to Java is, but I don't see any tips for how to make this warning go away when working with Scala.
我看到很多关于 Java 变化的解释,但我没有看到有关如何在使用 Scala 时消除此警告的任何提示。
OS X 10.9.4. Scala 2.11.1. sbt 0.13.5
OS X 10.9.4。斯卡拉 2.11.1。sbt 0.13.5
Edit
编辑
Basically what I'm asking is "Where are all the places on my system MaxPermSize
might get set?"
基本上我要问的是“我系统上的所有位置都在哪里MaxPermSize
设置?”
I don't have a sbt-launch-lib.bash
set on my machine.
sbt-launch-lib.bash
我的机器上没有设置。
I did find MaxPermSize
Scala->JVM Parameters option of IntelliJ. Removing that makes the warning go away in IntelliJ.
我确实找到MaxPermSize
了 IntelliJ 的 Scala->JVM 参数选项。删除它会使警告在 IntelliJ 中消失。
Edit
编辑
Changed question. I originally said that this happened for SBT. (Some of the comments below address this.) This was an error on my part. It doesn't happen when I run SBT, only when I run play
from the command line.
改变了问题。我最初说这发生在 SBT 上。(下面的一些评论解决了这个问题。)这是我的一个错误。当我运行 SBT 时不会发生这种情况,只有当我从命令行运行时才会发生这种情况play
。
Is it a known bug for Play to specify the MaxPermSize
parameter? Is there a way to make it stop?
Play 指定MaxPermSize
参数是一个已知的错误吗?有没有办法让它停止?
Edit
编辑
I don't think this is a duplicate of PermGen elimination in jdk 8. That thread describes why the warning appears but does not explain how to change the IntelliJ or Play configurations to make it no longer appear.
我不认为这是jdk 8中PermGen 消除的重复。该线程描述了警告出现的原因,但没有解释如何更改 IntelliJ 或 Play 配置以使其不再出现。
回答by Jigar Joshi
This warns that you are still assuming that this flag you are passing in would work but this flag has been removed from 1.8 onward, there is no perm space in jvm 1.8 onwards
这警告您仍然假设您传入的这个标志会起作用,但是这个标志已经从 1.8 开始被删除,在 jvm 1.8 之后没有永久空间
so to get rid of this warning remove -XX:MaxPermSize
from all the places which passes it to jvm from sbt
所以要摆脱这个警告,请-XX:MaxPermSize
从所有将它从 sbt 传递给 jvm 的地方删除
For example, on Windows you just need to edit the file C:\Program Files (x86)\sbt\conf\sbtconfig.txt
and edit to change it to comment the XX:MaxPermSize=256M
. For example:
例如,在 Windows 上,您只需要编辑文件C:\Program Files (x86)\sbt\conf\sbtconfig.txt
并编辑以将其更改为注释XX:MaxPermSize=256M
. 例如:
-Xmx512M
#Commented parameter as it is deprecated on jvm 1.8 onwards
#-XX:MaxPermSize=256m
-XX:ReservedCodeCacheSize=128m
# Set the extra SBT options
-Dsbt.log.format=true
回答by lpiepiora
Sbt reads the settings from $SBT_LAUNCHER_HOME/sbt-launch-lib.bash
.
Sbt 从$SBT_LAUNCHER_HOME/sbt-launch-lib.bash
.
You can find following fragment, and remove -XX:MaxPermSize=${perm}m
.
您可以找到以下片段,并删除-XX:MaxPermSize=${perm}m
.
get_mem_opts () {
local mem=${1:-1024}
local perm=$(( $mem / 4 ))
(( $perm > 256 )) || perm=256
(( $perm < 1024 )) || perm=1024
local codecache=$(( $perm / 2 ))
echo "-Xms${mem}m -Xmx${mem}m -XX:MaxPermSize=${perm}m -XX:ReservedCodeCacheSize=${codecache}m"
}
PS. On windows it's in conf/sbtconfig.txt
.
附注。在 Windows 上,它位于conf/sbtconfig.txt
.
回答by David Keen
You may see this warning when IntelliJ is loading the project. You can stop this warning by removing any -XX:MaxPermSize
values from the SBT settings in Preferences > "VM parameters".
当 IntelliJ 加载项目时,您可能会看到此警告。您可以通过-XX:MaxPermSize
从首选项 >“VM 参数”中的 SBT 设置中删除任何值来停止此警告。
The actual JVM options used when running a Play2 app in IntelliJ don't seem to be exposed in the interface but you can edit your workspace.xml
file manually. Look for the play2JvmOptions
setting:
在 IntelliJ 中运行 Play2 应用程序时使用的实际 JVM 选项似乎并未在界面中公开,但您可以workspace.xml
手动编辑文件。查找play2JvmOptions
设置:
<setting name="play2JvmOptions" value="-Xms512M -Xmx1024M -Xss1M -XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=256M" />
and remove the -XX:MaxPermSize
value.
并删除该-XX:MaxPermSize
值。
Whether you think it's worth messing with your workspace.xml for the sake of a warning is up to you...
您是否认为值得为了警告而弄乱您的 workspace.xml 取决于您...
回答by f1v3
I know it's an old question, but if you're using IntelliJ, this entry:
我知道这是一个老问题,但如果您使用的是 IntelliJ,则此条目:
-XX:MaxPermSize=512m
can also be found in one of these files:
也可以在以下文件之一中找到:
PATH_TO_INTELLIJ\bin\idea.exe.vmoptions
PATH_TO_INTELLIJ\bin\idea64.exe.vmoptions
Maybe removing it there could help?
也许在那里删除它会有所帮助?
回答by Ramadas
The -XX:MaxPermSize option is specified on the "build" file inside the play framework installation folder. Removing the MaxPermSize entry removed the warning when running play project.
-XX:MaxPermSize 选项在 play 框架安装文件夹内的“build”文件中指定。删除 MaxPermSize 条目删除了运行 play 项目时的警告。
eg: /play-2.2.1/framework/build
例如:/play-2.2.1/framework/build
回答by durp
In IntelliJ, some default run configurations include specific VM paramters.
在 IntelliJ 中,一些默认运行配置包括特定的 VM 参数。
For example, the default SBT Task run configuration VM parameters include the setting "-XX:MaxPermSize=256M"
例如,默认的 SBT 任务运行配置 VM 参数包括设置“-XX:MaxPermSize=256M”
You can simply remove this entry from the default or from your custom run config and no more warnings will appear.
您可以简单地从默认值或自定义运行配置中删除此条目,并且不会出现更多警告。
回答by Amit
Actually its very easy JAVA-8 has deprecated MaxPermSize, what you need to do is simply edit your vmoptions file and replace
实际上它很容易 JAVA-8 已弃用 MaxPermSize,您需要做的只是编辑您的 vmoptions 文件并替换
-XX:MaxPermSize by -XX:MaxMetaspaceSize=128m
回答by Brideau
For anybody experiencing this on OS X/macOS, the solution for me was to go to the menu IntelliJ IDEA > Preferences...
, then to Other Settings > SBT
and clear the field VM parameters
.
对于在 OS X/macOS 上遇到此问题的任何人,我的解决方案是转到 menu IntelliJ IDEA > Preferences...
,然后转到Other Settings > SBT
并清除该字段VM parameters
。
As akauppi also mentioned below, there is also another set of parameters in IntelliJ IDEA > Preferences...
under Build, Execution, Deployment > Built Tools > sbt
正如下面akauppi还提到,还有另一组在参数IntelliJ IDEA > Preferences...
下Build, Execution, Deployment > Built Tools > sbt
回答by sendon1982
回答by anoneironaut
Just to add to this discussion. My sbt
command ended up being a script, I simply edited the script and removed the MaxPermSize
reference.
只是为了补充这个讨论。我的sbt
命令最终成为一个脚本,我只是编辑了脚本并删除了MaxPermSize
引用。
I know this is about play, but searches for sbt and MaxPermSize end up here.
我知道这是关于游戏的,但搜索 sbt 和 MaxPermSize 最终会出现在这里。