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

相关推荐
神码小Z8 小时前
为什么架构师岗位即将消失?学会使用Cursor的三大神器Rules、Memories、Commands!小白也能写出专家级代码!
ide·intellij-idea
139的世界真奇妙18 小时前
【Goland&IDE各种字体设置记录】
go·intellij-idea·idea
南河的南1 天前
解决IDEA无法下载Maven仓库的源码
java·maven·intellij-idea
DXDZ20222 天前
0526P,CSL05U6U USB3.0静电防护阵列
typescript·intellij-idea·推荐算法
两广总督是码农2 天前
IDEA-SpringBoot热部署
java·spring boot·intellij-idea
洛克大航海2 天前
Ubuntu 中安装 Scala 及在 IntelliJ IDEA 中配置 Scala开发环境
scala·intellij-idea·ubuntu24.04
细水长流,生命不止2 天前
IDEA使用本地maven的jar
maven·intellij-idea·jar
菜择贰2 天前
为IDEA创建Linux桌面快捷方式
java·linux·intellij-idea
烤麻辣烫3 天前
黑马程序员苍穹外卖后端概览
xml·java·数据库·spring·intellij-idea
P***84393 天前
idea创建springBoot的五种方式
java·spring boot·intellij-idea