如果修改了idea64.exe.vmoptions文件中的参数,然后导致idea打不开,那么此文一定能帮你解决问题。
有的小伙伴出现此类问题之后,可能尝试的重装IntelliJ IDEA的方法,但是重装之后发现还是解决不了问题,还是会弹出如下错误提示框。
问题类似如下图:
错误文本:
Improperly specified VM option. To fix the problem,edit your JVM options and remove the options that are obsolete or not supported by the current version of the JVM.
Failed to create JVM.JVM Path:C:\JetBrains Series\Intellij_IDEA\IntelliJ IDEA 2019.3.3\jbr\
或者出现如下问题:
错误文本:
If you already have a 64-bit JDK installed,define a JAVA_HOME variable in Computer > System Properties > System Settings > Environment Variables
Failed to create JVM. JVM Path:C:\JetBrains Series\Intellij_IDEA\IntelliJ IDEA 2019.3.3\jbr\
一、前言
IntelliJ IDEA会将默认的配置数据缓存在C盘,如果你的IntelliJ IDEA安装在D盘,出现上述问题之后,不管你是删除D盘中的IntelliJ IDEA文件夹还是修改D盘中的idea.exe.vmoptions
或者idea64.exe.vmoptions
文件会发现都没有解决问题。
IntelliJ IDEA会读取缓存在C盘的数据,所以只有你修改的C盘中的数据缓存才会真正解决问题。
二、修改配置文件
首先,我们找到IntelliJ IDEA在C盘的缓存文件夹,默认为:C盘==>用户文件夹==>用户名文件夹==>.IntelliJIdea
==>config
然后,使用记事本编辑idea.exe.vmoptions
或idea64.exe.vmoptions
文件
最后一步,将idea.exe.vmoptions
或idea64.exe.vmoptions
文件的数据更改为正确配置,然后保存
下面为IntelliJ IDEA 2019.3.3 x64版本下的idea.exe.vmoptions
文件的默认配置:
-server
-Xms128m
-Xmx512m
-XX:ReservedCodeCacheSize=240m
-XX:+UseConcMarkSweepGC
-XX:SoftRefLRUPolicyMSPerMB=50
-ea
-XX:CICompilerCount=2
-Dsun.io.useCanonPrefixCache=false
-Djava.net.preferIPv4Stack=true
-Djdk.http.auth.tunneling.disabledSchemes=""
-XX:+HeapDumpOnOutOfMemoryError
-XX:-OmitStackTraceInFastThrow
-Djdk.attach.allowAttachSelf=true
-Dkotlinx.coroutines.debug=off
-Djdk.module.illegalAccess.silent=true
下面为IntelliJ IDEA 2019.3.3 x64版本下的idea64.exe.vmoptions
文件的默认配置:
-Xms128m
-Xmx750m
-XX:ReservedCodeCacheSize=240m
-XX:+UseConcMarkSweepGC
-XX:SoftRefLRUPolicyMSPerMB=50
-ea
-XX:CICompilerCount=2
-Dsun.io.useCanonPrefixCache=false
-Djava.net.preferIPv4Stack=true
-Djdk.http.auth.tunneling.disabledSchemes=""
-XX:+HeapDumpOnOutOfMemoryError
-XX:-OmitStackTraceInFastThrow
-Djdk.attach.allowAttachSelf=true
-Dkotlinx.coroutines.debug=off
-Djdk.module.illegalAccess.silent=true
如果你的电脑内存足够大的话还可以增大如下参数来提高IntelliJ IDEA加载大项目的速度(我的电脑为16G内存)。
下图为我的电脑的idea64.exe.vmoptions
文件配置参数供大家参考(我的电脑为16G内存):
关键的三个参数的说明
1、-Xms 是最小启动内存参数
2、-Xmx 是最大运行内存参数
3、-XX:ReservedCodeCacheSize 保留代码占用的内存容量参数
三、最后
如果此文解决了你的问题,那就点个赞再走吧!愿你的代码远离BUG,环境永不崩溃。