无法识别的 VM 选项 'UseCompressedStrings' - Intellij IDEA 无法启动

Unrecognized VM option 'UseCompressedStrings' - Intellij IDEA doesn't lauch

我通过 IDEA 添加了 UseCompressedStrings VM 选项并将其关闭。现在,当我再次尝试启动 IDEA 时,它无法启动。我收到以下错误:

OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
Unrecognized VM option 'UseCompressedStrings'
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

我检查了 idea64.vmoptionsidea.vmoptions 以删除这个无法识别的标志,但 UseCompressedStrings 标志不存在。我不知道如何从那里解决问题,所以我卸载并重新安装了 IDEA 和 java 希望错误会消失,但错误仍然存​​在。请注意,我在 64vmoptions 文件中也增加了堆大小,但也没有了。谁能建议如何解决这个问题?

UseCompressedStrings 是一个很久以前就被弃用的特性,并在 Java 7 中被删除。它在现代 JVM 中不是一个有效的 VM 选项。

从Java9开始,有一个similar feature called "compact strings" and it is enabled by default. Like "UseCompressedStrings" this feature uses a byte array to store strings when it's possible. You can read more details about "compact strings" and how it compares with "compressed strings" in this article.

所以我最终在 ubuntu 中进行了全局搜索,如下所示:

grep ~ -rnw -e "UseCompressedStrings"

发现配置备份在:

/home/{username}/.config/JetBrains/IntelliJIdea2020.1/idea64.vmoptions

这就是为什么尽管重新安装了 java 和 intellij,这个无效的选项仍然对 jvm 可见。所以我删除了那里的线路,一切正常。

此类问题的常见解决方案(Ubuntu):

  1. 找到路径/home/$USER/.config/JetBrains/IntelliJIdea2021.1
  2. 删除 JVM 参数的弃用配置。
  3. 重启intelliJiIdea