Idea Version: “2019.3”
Question:
在IDEA的“Help | Edit Custom VM Options”菜单中修改了“.vmoptions”配置,(改错了文件路径),重启多次,软件一直打不开。即便卸载重装软件,问题依然复现。
一、".vmoptions" 官方描述
Configuring JVM options and platform properties 通过学习上述文档,发现
1)IDEA中“.vmoptions”文件有2份
VM options are loaded from the IDE_HOME\bin\<product>[bits][.exe].vmoptions file or from the copy
of this file in the config directory (if it exists). Please note that .vmoptions
file from the config directory has the priority over the original file in the bin directory.
VM选项是从“IDE_HOME\bin\<product>[bits][.exe].vmoptions”文件 或 config目录中.vmoptions的副本中加载的。注意,config目录中的.vmoptions文件执行优先级高于Idea安装路径下bin目录中的原始文件。
2)“Help | Edit Custom VM Options”菜单编辑的是Config下的副本文件
Mac OS X Specifics
Don't edit .vmoptions and .properties files directly, it will violate the application signature,
always make a copy of the files under IDE configuration directory and edit the copy instead. See this answer for details.
The original file is located in /Applications/<Product>.app/Contents/bin folder (/Applications/<Product>.app/bin for older IDE versions).
针对mac的说明:
不要直接编辑".vmoptions"和".properties"文件(原始文件位于/Applications/<Product>.app/Contents/bin文件夹,对于较早的IDE版本,为/Applications/<Product>.app/bin),这会违反应用程序签名,请始终在IDE配置目录下创建文件的副本,然后编辑该副本。即在 “Help | Edit Custom VM Options”菜单中执行编辑。
3)Mac OS Config副本文件地址
Configuration (idea.config.path):
~/Library/Preferences/<PRODUCT><VERSION>
综上可知,即便重装IDEA,软件也打不开,在于“Help | Edit Custom VM Options”编辑的是“~/Library/Preferences/<PRODUCT><VERSION>” 这里的副本。
二、删除.vmoptions的“副本文件”
如上,“/User/用户名/Library/Preferences/”路径下,并未发现“IntelliJIdea”相关文件。。。
考虑隐藏文件的原因,通过Finder查看,目录存在:
删除其中的“.vmoptions”文件,重启即可打开IDEA。