在 OS X Sierra 上使用 PhpStorm 打开项目时出现 NoClassDefFoundError 和 NullPointerException
NoClassDefFoundError and NullPointerException when opening a project with PhpStorm on OS X Sierra
最近在我的 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 版本。
- 为了能够启动应用,我也关注了
- 为了检查一下,我还安装了 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
我在将 jdk 升级到 11 时使用了 Intelli-J。
我按照此处的说明将它运行的 jdk 改回 8:
配置文件位置可能也需要这个 link
https://intellij-support.jetbrains.com/hc/en-us/articles/206544519
最近在我的 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 版本。 - 为了能够启动应用,我也关注了
- 为了检查一下,我还安装了 Webstorm,开箱即用。
经过一番研究,似乎没有其他人遇到过这个问题。我真的需要一些灵感,一些疯狂的想法来尝试。
PS: 我上传了日志文件 here 如果有人想浏览它。
找到更好的解决方案,可以用homebrew
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 jrelib
folder inside thePhpstorm.app
packagesudo 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 IDEchmod 744 /Applications/PhpStorm.app/Contents/bin/fsnotifier
我在将 jdk 升级到 11 时使用了 Intelli-J。
我按照此处的说明将它运行的 jdk 改回 8:
配置文件位置可能也需要这个 link
https://intellij-support.jetbrains.com/hc/en-us/articles/206544519