Error while importing sbt project: Error occurred during initialization of VM Could not reserve eno

最近换了机器,将开放环境迁移到新的笔记本上,一直用着没啥问题,但是今天在导入新的项目代码时,错误提示:

Error while importing sbt project:

 

Error occurred during initialization of VM

Could not reserve enough space for 2097152KB object heap

然后开始调参,由于我的机器内存够用,所以调了更大的内存分配,但是还是会报错,然后反方向调小了,一直报错,一直到内存分配小于1G,如图:

Error while importing sbt project: Error occurred during initialization of VM Could not reserve eno_第1张图片

终于不再报错,但是项目build过程超级慢,检查了以前的旧机器,同样条件的台式机确没有任何问题,百思不得其解。

后来,在cmd窗口输入Java -Xmx2048M -version命令结果发现:

再次输入Java -Xmx1G -version如图:

Error while importing sbt project: Error occurred during initialization of VM Could not reserve eno_第2张图片

之后在旧机器和同事机器上试了一下,都正常。

这才想到这次换机器,搭建开发环境的时候,我安装的JDK是同事给的这个:

Error while importing sbt project: Error occurred during initialization of VM Could not reserve eno_第3张图片

带有Windows字样,原先安装的是没有的。

不同的JDK支持的内存不同,同样的版本不同的厂商提供也是有区别的。

这话以前听过没当回事,这回算是领会到了。

你可能感兴趣的:(java开发,Intellij,idea,JDK)