插件 'org.sonarlint.idea' 初始化失败,将被禁用。请重启 IntelliJ IDEA

Plugin 'org.sonarlint.idea' failed to initialize and will be disabled. Please restart IntelliJ IDEA

当我尝试在我的 IntelliJ.

上安装 SonarLint 插件时出现上述错误

Mac OS X Yosemite 10.10.5

IntelliJ 15.06

SonarLint Plugin 2.2 (tried 2.1 also)

我的 JDK 设置为 1.8 但不确定是什么导致了这个问题。任何帮助将不胜感激。

        Plugin 'org.sonarlint.idea' failed to initialize and will be disabled.  Please restart IntelliJ IDEA.

        com.intellij.diagnostic.PluginException: org/sonarlint/intellij/config/global/SonarLintGlobalSettings : Unsupported major.minor version 51.0 [Plugin: org.sonarlint.idea]
        at com.intellij.ide.plugins.cl.PluginClassLoader.b(PluginClassLoader.java:130)
        at com.intellij.ide.plugins.cl.PluginClassLoader.a(PluginClassLoader.java:77)
        at com.intellij.ide.plugins.cl.PluginClassLoader.loadClass(PluginClassLoader.java:66)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:249)
        at com.intellij.openapi.components.impl.ComponentManagerImpl.a(ComponentManagerImpl.java:408)
        at com.intellij.openapi.components.impl.ComponentManagerImpl.init(ComponentManagerImpl.java:96)
        at com.intellij.openapi.application.impl.ApplicationImpl.load(ApplicationImpl.java:455)
        at com.intellij.openapi.application.impl.ApplicationImpl.load(ApplicationImpl.java:447)
        at com.intellij.idea.IdeaApplication.run(IdeaApplication.java:194)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at com.intellij.idea.MainImpl.run(MainImpl.java:60)
        at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
        at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:715)
        at java.awt.EventQueue.access0(EventQueue.java:82)
        at java.awt.EventQueue.run(EventQueue.java:676)
        at java.awt.EventQueue.run(EventQueue.java:674)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.security.AccessControlContext.doIntersectionPrivilege(AccessControlContext.java:86)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:685)
        at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:361)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296)
        at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:201)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:196)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:188)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
        Caused by: java.lang.UnsupportedClassVersionError: org/sonarlint/intellij/config/global/SonarLintGlobalSettings : Unsupported major.minor version 51.0
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClassCond(ClassLoader.java:637)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:471)
        at com.intellij.util.lang.UrlClassLoader._defineClass(UrlClassLoader.java:260)
        at com.intellij.util.lang.UrlClassLoader.defineClass(UrlClassLoader.java:256)
        at com.intellij.util.lang.UrlClassLoader._findClass(UrlClassLoader.java:225)
        at com.intellij.ide.plugins.cl.PluginClassLoader.b(PluginClassLoader.java:124)
        ... 30 more

以下表示JDK你是运行无法加载用JDK7编译的类:Unsupported major.minor version 51.0

在菜单'IntelliJ => About IntelliJ Idea'中勾选Intellij使用的JDK。

用于 IntelliJ 2.2 的 SonarLint 需要 JDK >= 7。另请注意,即将推出的新版本可能需要 JDK >= 8.

要更改 intellij 默认使用的 JVM,请参考 https://intellij-support.jetbrains.com/entries/23455956-Selecting-the-JDK-version-the-IDE-will-run-under

可以更新/Applications/IntelliJ\IDEA\14\CE.app/Contents/Info.plist

并将 JVMVersion 1.6* 替换为 1.8*

JVM 版本 1.8*