MacBook系统升级导致idea无法打开

1 背景

MacBook的MacOS系统升级之后,之前安装的idea无法打开了。idea卸载重装仍然无法打开。

2 原因排查

2.1 寻找报错原因

为了了解具体的报错原因,通过"访达-应用程序"找到"IntelliJ IDEA",然后右击打开"显示包内容"选项进入IntelliJ IDEA的安装目录,通过"Contents-MacOS" 找到名称为"idea"的文件启动idea。在控制台能看到idea的启动过程和报错信息。具体如下。

bash 复制代码
The default interactive shell is now zsh.
To update your account to use zsh, please run `chsh -s /bin/zsh`.
For more details, please visit https://support.apple.com/kb/HT208050.
mynamedembp:~ myname$ /Applications/IntelliJ\ IDEA.app/Contents/MacOS/idea ; exit;
2024-04-21 18:14:10.101 idea[4108:118253] allVms required 1.8*,1.8+
2024-04-21 18:14:10.104 idea[4108:118259] Value of IDEA_VM_OPTIONS is (null)
2024-04-21 18:14:10.104 idea[4108:118259] Processing VMOptions file at /Users/myname/Library/Preferences/IntelliJIdea2019.3/idea.vmoptions
2024-04-21 18:14:10.104 idea[4108:118259] Done
OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
Error opening zip file or JAR manifest missing : /IT/soft/IT/idea/2019/jetbrains-agent/jetbrains-agent.jar
Error occurred during initialization of VM
agent library failed to init: instrument
logout

Saving session...
...copying shared history...
...saving history...truncating history files...
...completed.

由上可知,关键信息为

Error opening zip file or JAR manifest missing : /IT/soft/IT/idea/2019/jetbrains-agent/jetbrains-agent.jar

2.2 原因分析

由报错信息可知,无法解析 jetbrains-agent.jar,或者通过该路径找不到 jetbrains-agent.jar。

MacOS系统升级后,idea的配置文件被保留了下来。idea卸载之后,其配置文件(/Users/myname/Library/Preferences/IntelliJIdea2019.3/idea.vmoptions)不会被删除,重新安装之后,会依旧使用原来的配置文件,且信息不变。

而上述idea.vmoptions文件中配置了jetbrains-agent.jar的位置信息。并且在MacOS系统升级后,由于jetbrains-agent.jar所在的文件夹位置被自动调整了,导致idea.vmoptions文件中存储的jetbrains-agent.jar位置不正确(存储的为升级前文件所在的位置),从而导致通过**配置的路径找不到 jetbrains-agent.jar。**进而导致无法打开idea。

备注:默认情况下"Library"文件是被隐藏的,可以通过 "shift(即向上的大箭头)+command+."显示被隐藏的文件夹。

3 问题解决

重新设置 /Users/myname/Library/Preferences/IntelliJIdea2019.3/idea.vmoptions 文件中的 jetbrains-agent.jar 的位置信息即可。

相关推荐
Hungry_Shark3 天前
IDEA版本控制管理之使用Gitee
java·gitee·intellij-idea
赛姐在努力.3 天前
《IDEA 突然“三无”?三秒找回消失的绿色启动键、主菜单和项目树!》
java·intellij-idea
小蕾Java3 天前
Java 开发工具,最新2025 IDEA使用(附详细教程)
java·ide·intellij-idea
星月前端3 天前
idea没法识别springboot项目的一个原因解决及办法
java·spring boot·intellij-idea
Chan164 天前
JVM从入门到实战:从字节码组成、类生命周期到双亲委派及打破双亲委派机制
java·jvm·spring boot·后端·intellij-idea
煎饼皮皮侠4 天前
【图解】idea中快速查找maven冲突
java·maven·intellij-idea·冲突
嘟嘟可在哪里。4 天前
IntelliJ IDEA git凭据帮助程序
java·git·intellij-idea
DTS小夏4 天前
Linux 系统 + IDEA+Scala 插件:新手进阶开发指南
linux·scala·intellij-idea
脑子慢且灵5 天前
[JavaWeb]模拟一个简易的Tomcat服务(Servlet注解)
java·后端·servlet·tomcat·intellij-idea·web
AD钙奶-lalala5 天前
idea新建的项目new 没有java class选项
java·ide·intellij-idea