0

当我尝试在我的IntelliJ上安装SonarLint插件时出现上述错误。

Mac OS X 优胜美地 10.10.5

智能 15.06

SonarLint 插件 2.2(也试过 2.1)

我的 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$1$1$1.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.access$400(EventQueue.java:82)
        at java.awt.EventQueue$2.run(EventQueue.java:676)
        at java.awt.EventQueue$2.run(EventQueue.java:674)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.security.AccessControlContext$1.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
4

2 回答 2

3

以下表示您正在运行的 JDK 无法加载使用 JDK 7 编译的类:Unsupported major.minor version 51.0

在“IntelliJ => About IntelliJ Idea”菜单中检查 Intellij 使用的 JDK。

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

于 2016-06-21T11:57:51.183 回答
3

要更改 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*

于 2017-03-08T07:22:41.367 回答