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

相关推荐
通域1 小时前
解决启动IDEA后CPU 及内存占用过高配置调整
java·ide·intellij-idea
我命由我123453 小时前
Java 并发编程 - Delay(Delayed 概述、Delayed 实现、Delayed 使用、Delay 缓存实现、Delayed 延迟获取数据实现)
java·开发语言·后端·缓存·java-ee·intellij-idea·intellij idea
北城以北88883 小时前
SSM--MyBatis框架之缓存
java·缓存·intellij-idea·mybatis
凌波粒6 小时前
MyBatis完整教程IDEA版(3)--动态SQL/MyBatis缓存
sql·intellij-idea·mybatis
李少兄1 天前
IDEA / DataGrip 连接 SQL Server 提示“驱动程序无法通过 SSL 加密建立安全连接”的解决方法
安全·intellij-idea·ssl
我命由我123451 天前
IDEA - IDEA 快速回到页面首尾、页面快速滑动、快速定位到指定行
java·运维·ide·后端·java-ee·intellij-idea·intellij idea
Mickyจุ๊บ1 天前
IDEA 插件推荐
java·ide·intellij-idea
命运之光1 天前
【快速解决】idea运行javafx错误: 缺少 JavaFX 运行时组件, 需要使用该组件来运行此应用程序
java·ide·intellij-idea
N 年 后2 天前
cursor和传统idea的区别是什么?
java·人工智能·intellij-idea