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 的位置信息即可。

相关推荐
杰哥技术分享10 小时前
IDEA 打开文件乱码
java·ide·intellij-idea
猫头虎10 小时前
[特殊字符]解决 “IDEA 登录失败。不支持早于 14.0 的 GitLab 版本” 问题的几种方法
java·ide·网络协议·http·https·gitlab·intellij-idea
紫乾20141 天前
idea json生成实体类
java·json·intellij-idea
Java斌1 天前
70年使用权的IntelliJ IDEA Ultimate安装教程
java·ide·intellij-idea
Bruk.Liu2 天前
《IDEA 高效开发:自定义类/方法注释模板详解》
java·ide·intellij-idea·注释
叶 落2 天前
[Java 基础]选英雄(配置 IDEA)
java·ide·intellij-idea
陈丹阳(滁州学院)2 天前
解决idea编译运行项目时间长的问题
java·intellij-idea·idea
小伍_Five2 天前
Spark实战能力测评模拟题精析【模拟考】
java·大数据·spark·scala·intellij-idea
青衫红叶2 天前
Idea使用springAI搭建MCP项目
java·spring cloud·maven·intellij-idea·spring-ai
对酒当歌丶人生几何2 天前
IDEA集成JRebel插件,实现实时热部署
java·ide·intellij-idea·jrebel