英文:
IntelliJ ignoring project SDK and using the wrong Java version
问题
我知道如何设置项目的SDK,并且已将其设置为JDK 1.7,但当我的应用程序运行时,似乎在使用JDK 1.8。
此外,IntelliJ 似乎使用正确的JVM 启动。
然而,在运行几秒钟后,它会出现一系列无休止的错误,如下所示,如果它确实使用了Java 1.8,就像这个回答中所描述的那样:Incompatible JVM in GGTS (Eclipse) and JAVA 1.8
2020年10月27日 上午11:46:17 org.springsource.loaded.jvm.JVM copyMethod
严重: 复制方法时出现问题。不兼容的JVM?
java.lang.reflect.InvocationTargetException
at sun.reflect.GeneratedMethodAccessor75.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springsource.loaded.jvm.JVM.copyMethod(JVM.java:134)
at org.springsource.loaded.ri.OriginalClassInvoker.createJavaMethod(OriginalClassInvoker.java:68)
at org.springsource.loaded.ri.ReflectiveInterceptor.jlClassGetDeclaredMethods(ReflectiveInterceptor.java:151)
at org.codehaus.groovy.grails.commons.ClassPropertyFetcher.init(ClassPropertyFetcher.java:181)
at org.codehaus.groovy.grails.commons.ClassPropertyFetcher.<init>(ClassPropertyFetcher.java:91)
at org.codehaus.groovy.grails.commons.ClassPropertyFetcher.forClass(ClassPropertyFetcher.java:82)
at org.codehaus.groovy.grails.commons.ClassPropertyFetcher.forClass(ClassPropertyFetcher.java:63)
at org.codehaus.groovy.grails.commons.AbstractGrailsClass.<init>(AbstractGrailsClass.java:84)
at org.codehaus.groovy.grails.plugins.AbstractGrailsPlugin$GrailsPluginClass.<init>(AbstractGrailsPlugin.java:65)
at org.codehaus.groovy.grails.plugins.DefaultGrailsPlugin.initialisePlugin(DefaultGrailsPlugin.java:138)
at org.codehaus.groovy.grails.plugins.DefaultGrailsPlugin.<init>(DefaultGrailsPlugin.java:117)
at org.codehaus.groovy.grails.plugins.DefaultGrailsPlugin.<init>(DefaultGrailsPlugin.java:264)
at org.codehaus.groovy.grails.plugins.DefaultGrailsPluginManager.createGrailsPlugin(DefaultGrailsPluginManager.java:411)
at org.codehaus.groovy.grails.plugins.DefaultGrailsPluginManager.findUserPlugins(DefaultGrailsPluginManager.java:436)
at org.codehaus.groovy.grails.plugins.DefaultGrailsPluginManager.attemptLoadPlugins(DefaultGrailsPluginManager.java:348)
at org.codehaus.groovy.grails.plugins.DefaultGrailsPluginManager.loadPlugins(DefaultGrailsPluginManager.java:256)
at org.codehaus.groovy.grails.project.plugins.GrailsProjectPluginLoader$_loadPlugins_closure2.doCall(GrailsProjectPluginLoader.groovy:103)
at org.codehaus.groovy.grails.project.plugins.GrailsProjectPluginLoader$_loadPlugins_closure2.call(GrailsProjectPluginLoader.groovy)
at org.codehaus.groovy.grails.cli.api.BaseSettingsApi.profile(BaseSettingsApi.java:342)
at org.codehaus.groovy.grails.project.plugins.GrailsProjectPluginLoader.loadPlugins(GrailsProjectPluginLoader.groovy:99)
at org.codehaus.groovy.grails.plugins.GrailsPluginManagerFactoryBean.afterPropertiesSet(GrailsPluginManagerFactoryBean.java:75)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1613)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1550)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:302)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:298)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
英文:
I know how to set the project SDK, and that's set to JDK 1.7, but when my app runs it appears to be using JDK 1.8.
Furthermore, InteliJ seems to start with the right JVM.
However, after a few seconds of running it presents an endless series of errors like this, which you would expect if it was using Java 1.8 as described in this answer: Incompatible JVM in GGTS (Eclipse) and JAVA 1.8
Oct 27, 2020 11:46:17 AM org.springsource.loaded.jvm.JVM copyMethod
SEVERE: Problems copying method. Incompatible JVM?
java.lang.reflect.InvocationTargetException
at sun.reflect.GeneratedMethodAccessor75.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springsource.loaded.jvm.JVM.copyMethod(JVM.java:134)
at org.springsource.loaded.ri.OriginalClassInvoker.createJavaMethod(OriginalClassInvoker.java:68)
at org.springsource.loaded.ri.ReflectiveInterceptor.jlClassGetDeclaredMethods(ReflectiveInterceptor.java:151)
at org.codehaus.groovy.grails.commons.ClassPropertyFetcher.init(ClassPropertyFetcher.java:181)
at org.codehaus.groovy.grails.commons.ClassPropertyFetcher.<init>(ClassPropertyFetcher.java:91)
at org.codehaus.groovy.grails.commons.ClassPropertyFetcher.forClass(ClassPropertyFetcher.java:82)
at org.codehaus.groovy.grails.commons.ClassPropertyFetcher.forClass(ClassPropertyFetcher.java:63)
at org.codehaus.groovy.grails.commons.AbstractGrailsClass.<init>(AbstractGrailsClass.java:84)
at org.codehaus.groovy.grails.plugins.AbstractGrailsPlugin$GrailsPluginClass.<init>(AbstractGrailsPlugin.java:65)
at org.codehaus.groovy.grails.plugins.DefaultGrailsPlugin.initialisePlugin(DefaultGrailsPlugin.java:138)
at org.codehaus.groovy.grails.plugins.DefaultGrailsPlugin.<init>(DefaultGrailsPlugin.java:117)
at org.codehaus.groovy.grails.plugins.DefaultGrailsPlugin.<init>(DefaultGrailsPlugin.java:264)
at org.codehaus.groovy.grails.plugins.DefaultGrailsPluginManager.createGrailsPlugin(DefaultGrailsPluginManager.java:411)
at org.codehaus.groovy.grails.plugins.DefaultGrailsPluginManager.findUserPlugins(DefaultGrailsPluginManager.java:436)
at org.codehaus.groovy.grails.plugins.DefaultGrailsPluginManager.attemptLoadPlugins(DefaultGrailsPluginManager.java:348)
at org.codehaus.groovy.grails.plugins.DefaultGrailsPluginManager.loadPlugins(DefaultGrailsPluginManager.java:256)
at org.codehaus.groovy.grails.project.plugins.GrailsProjectPluginLoader$_loadPlugins_closure2.doCall(GrailsProjectPluginLoader.groovy:103)
at org.codehaus.groovy.grails.project.plugins.GrailsProjectPluginLoader$_loadPlugins_closure2.call(GrailsProjectPluginLoader.groovy)
at org.codehaus.groovy.grails.cli.api.BaseSettingsApi.profile(BaseSettingsApi.java:342)
at org.codehaus.groovy.grails.project.plugins.GrailsProjectPluginLoader.loadPlugins(GrailsProjectPluginLoader.groovy:99)
at org.codehaus.groovy.grails.plugins.GrailsPluginManagerFactoryBean.afterPropertiesSet(GrailsPluginManagerFactoryBean.java:75)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1613)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1550)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:302)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:298)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
答案1
得分: 0
事实证明,我通过sdkman配置的Java默认版本为1.8,与我的应用程序正在使用的JAVA_HOME
值设置相匹配。我只需要在运行配置中覆盖这个值。
运行 > 编辑配置...
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论