gpt4 book ai didi

java - 在 OS X Sierra 上使用 PhpStorm 打开项目时出现 NoClassDefFoundError 和 NullPointerException

转载 作者:太空宇宙 更新时间:2023-11-04 11:02:42 25 4
gpt4 key购买 nike

最近在我的Mac Pro(Sierra 10.12.6)上安装了PhpStorm 2017.2.4,Java版本是(9+181)。

每当我尝试打开项目时,PhpStorm 就会挂起。我查看了位于 /Library/Logs/PhpStorm2017.2 中的日志文件。发生了几个 NoClassDefFoundError ,并伴有 NullPointerException 的一部分。以下是一些摘录:

java.lang.NoClassDefFoundError: com/apple/eawt/AppEvent$AboutEvent
java.lang.NoClassDefFoundError: com/apple/eawt/OpenURIHandler
java.lang.NoClassDefFoundError: javax/xml/bind/DatatypeConverter
java.lang.NoClassDefFoundError: Could not initialize class com.intellij.credentialStore.kdbx.KdbxKt
java.lang.NullPointerException at com.intellij.openapi.wm.impl.ToolWindowManagerImpl.b(ToolWindowManagerImpl.java:1800)
java.lang.NullPointerException at com.intellij.codeInsight.daemon.impl.DaemonListeners$MyProfileChangeListener.a(DaemonListeners.java:519)
  • 我尝试更改 PhpStorm 包内的 info.plist 配置文件中的目标 Java 版本。
  • 我也关注了these instructions以便能够启动应用程序。
  • 只是为了检查一下,我还安装了 Webstorm,它开箱即用,运行良好。

经过一番研究,似乎没有其他人遇到这个问题。我真的需要一些灵感,一些疯狂的想法来尝试。

PS:我上传了日志文件here如果有人想涉足其中。

最佳答案

找到了更好的解决方案,可以用homebrew安装PhpStorm

homebrew cask install phpstorm

效果非常好。

我将保留旧答案,以防万一有人需要此类信息。

Ooookay, I got it working. But that was not pretty.

So for some reason PhpStorm is not able to use its own bundled JDK. It's trying to use the system's default JDK, which is Java 9 for me.

Therefore i did something a bit extreme, I replaced the lib folder in the system's JDK by a symbolic link pointing to the jre lib folder inside the Phpstorm.app package

sudo ln -s /Applications/PhpStorm.app/Contents/jdk/Contents/Home/jre/lib /Library/Java/JavaVirtualMachines/jdk-9.jdk/Contents/Home/lib

Needless to say that you should not use this method if you have other applications using the system's JDK.

Thanks to LazyOne, whose comment gave me the 'aha!' moment.

PS: if anyone needs this information, I also had to give executing permissions to fsnotifier in order to be able to browse files within the IDE

chmod 744 /Applications/PhpStorm.app/Contents/bin/fsnotifier

关于java - 在 OS X Sierra 上使用 PhpStorm 打开项目时出现 NoClassDefFoundError 和 NullPointerException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46722665/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com