Skip to content

URGENT- "Java 11 or more recent is required to run. Please download and install a recent JDK" #1543

Closed

Description

@shanewaz-abbas

I don't understand why today I'm getting this error. Managed to temporarily solve this by downgrading Language Support for Java(TM) by Red Hat to 0.64.1.

image

image

Environment
  • Operating System: Windows_NT x64 10.0.20161 (remote ssh to ubuntu 18)
  • JDK version: Open jdk 8
  • Visual Studio Code version: 1.47.2 (user setup)
  • Java extension version: 0.9.1
  • Java Debugger extension version: 0.27.1

Activity

  1. fbricon commented on Jul 22, 2020

    @fbricon
    Collaborator

    As the message states, JDK 11 is now required to run the vscode-java extension. See https://github.com/redhat-developer/vscode-java/wiki/JDK-Requirements for more details.
    Warnings about this change have been displayed since mid-April (https://github.com/redhat-developer/vscode-java/blob/master/CHANGELOG.md#0600-april-16th-2020)

  2. fbricon commented on Jul 22, 2020

    @fbricon
    Collaborator

    @akaroml @jdneo @testforstephen @Eskibear can you make sure the Java extension pack JDK requirements align with vscode-java?

  3. shanewaz-abbas commented on Jul 22, 2020

    @shanewaz-abbas
    Author

    As the message states, JDK 11 is now required to run the vscode-java extension. See https://github.com/redhat-developer/vscode-java/wiki/JDK-Requirements for more details.
    Warnings about this change have been displayed since mid-April (https://github.com/redhat-developer/vscode-java/blob/master/CHANGELOG.md#0600-april-16th-2020)

    So I can still run my project without making changes, I just have to use jdk 11? Or did I misunderstand?

  4. fbricon commented on Jul 22, 2020

    @fbricon
    Collaborator

    Wiki page says it all:

    Do I need to migrate my projects to Java 11?

    NO you don't! Well you should, be we're not here to judge. It is still possible to compile/run Java applications from Java 1.5 to 14, provided the proper java.configuration.runtimes are configured in the user's settings.json.

  5. fbricon commented on Jul 22, 2020

    @fbricon
    Collaborator

    Even without setting java.configuration.runtimes, if you only have JDK 11 (or more recent) configured to run vscode-java, provided your project define compilation source/target, nothing will change

  6. pinned this issue on Jul 22, 2020
  7. seanGammage commented on Jul 22, 2020

    @seanGammage

    @shanewaz-abbas What are the steps you took to downgrade to 0.64.1? My company and most are reliant on Java 8, not 11 so this change is messing a lot of programmers up.

  8. fbricon commented on Jul 22, 2020

    @fbricon
    Collaborator

    @seanGammage you can still compile your projects with Java 8. JDK11 is only required to run vscode-java. See https://github.com/redhat-developer/vscode-java/wiki/JDK-Requirements for more details

  9. shanewaz-abbas commented on Jul 22, 2020

    @shanewaz-abbas
    Author

    Hey @seanGammage it seems like you can point to jdk 11 and it wouldn't impact running the project, though I haven't tried it as I am busy at the moment, and the downgrade was sufficient for me. To downgrade, you just have to go the java extension page and install another version and then reload.

    image

  10. seanGammage commented on Jul 22, 2020

    @seanGammage

    Awesome, thank you! @fbricon and @shanewaz-abbas

  11. thiscantbeserious commented on Jul 23, 2020

    @thiscantbeserious

    I noticed the new version tries to detect the language version used by the project (JavaSE-1.5) - how do I manage these? Any config? All these projects are not Maven/Gradle but are old Eclipse projects using IVY, so I can't just go ahead and modify them mindlessly. What I found out that there were some old Eclipse extension-settings stored with source-level set to 1.5 - I adjusted them to 1.8 (like the projects now require). But in the status bar there was still the JavaSE-1.8 mentioned ... in the old version everything worked in that regard, there weren't any issues with the projects.

    For now I also downgraded, until I get to understand how the runtime-configs work and how I can assign them to my Eclipse legacy-projects. I tried to config it like this:

        "java.home": "C:\\AdoptOpenJDK\\jdk-11.0.8.10-hotspot",
        "java.configuration.runtimes": [  
            {
              "name": "JavaSE-1.8",
              "path": "C:\\Java\\openjdk8u181-b13",
            },
        ],
    

    A bit off-topic but while we're at it: The Eclipse-Importer seems to ignore the "java.import.exclusions" config completely.

  12. jdneo commented on Jul 23, 2020

    @jdneo
    Collaborator

    @thiscantbeserious Basically, the setting java.configuration.runtimes won't change the language level of your project (except for the standalone files). This setting is used to tell the language server where different versions of the JDK are installed. The language server will pick up the matchest one according to your project's configuration.

    Would you mind to share the content of this file .settings/org.eclipse.jdt.core.prefs

  13. thiscantbeserious commented on Jul 23, 2020

    @thiscantbeserious

    That's the file(s) that previously had source-level set to 1.5 - I've adjusted these for the other projects and it happened to work fine judging from the code-completion for example with lambdas. From my quick test the new version didn't happen to catch it up in the status-bar ... I can't update to the new version right now since I need to finish a task but I'll try it later and will report back if there's any issues or if it was just a hiccup. Indeed I'm using the above config running the extension with OpenJDK 11 for now ... and it seems to work fine on 0.64.1, so at least that shouldn't be a blocker for me.

    eclipse.preferences.version=1
    org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=disabled
    org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
    org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
    org.eclipse.jdt.core.compiler.compliance=1.8
    org.eclipse.jdt.core.compiler.debug.lineNumber=generate
    org.eclipse.jdt.core.compiler.debug.localVariable=generate
    org.eclipse.jdt.core.compiler.debug.sourceFile=generate
    org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
    org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning
    org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
    org.eclipse.jdt.core.compiler.problem.deprecation=warning
    org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
    org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
    org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
    org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
    org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning
    org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
    org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
    org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
    org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
    org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
    org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
    org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
    org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
    org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
    org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
    org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
    org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
    org.eclipse.jdt.core.compiler.problem.missingSerialVersion=ignore
    org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
    org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
    org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
    org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
    org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
    org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
    org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
    org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
    org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
    org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
    org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
    org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
    org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
    org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
    org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
    org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
    org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
    org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
    org.eclipse.jdt.core.compiler.problem.unusedImport=warning
    org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
    org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
    org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
    org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
    org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=ignore
    org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
    org.eclipse.jdt.core.compiler.source=1.8
    
  14. 26 remaining items

  15. jjoker0110 commented on Nov 4, 2020

    @jjoker0110

    I'm still dealing with this issue as well. I'm on a restricted machine so I can't change my environment variables but I have a java.configuration.rutimes array with both Java 11 and the JDK that I need for my project and when I open "Configure Java Runtime" I only see that one. So then I add a java.home to my project settings and Java 11 disappears and the plugin breaks with the "Java 11 or more recent is required to run..." error.

  16. jjoker0110 commented on Nov 4, 2020

    @jjoker0110

    Just found a working solution: https://devblogs.microsoft.com/java/about-upgrading-to-java-11-for-vs-code-for-java

    Basically the java.home needs to point to java 11 and then in your java.configuration.runtimes array need to ONLY have the runtime you want your project to be in. This is annoying because you can't put the java.configuration.runtimes array in your projects settings.json, only in your machine/remote machine's settings.json

    Hope this helps

  17. plachta11b commented on Nov 14, 2020

    @plachta11b

    @jjoker0110 thanks. That helped to solve my problem.

    I have got path bellow by running echo $JAVA_HOME in the openjdk:11 container.

    Setting java.home in my devcontainer.json was probably enough to make it run.

    {
    //...
    	// Set *default* container specific settings.json values on container create.
    	"settings": { 
    		"terminal.integrated.shell.linux": null,
    		"java.home": "/usr/local/openjdk-11"
    	}
    //...
    }
    

    I installed gradle too. I do not know if I had to.

    RUN wget https://services.gradle.org/distributions/gradle-6.3-bin.zip -P /tmp && \
    	unzip -d /opt/gradle /tmp/gradle-6.3-bin.zip
    # todo rm gradle zip
    ENV GRADLE_HOME /opt/gradle/gradle-6.3
    ENV PATH ${GRADLE_HOME}/bin:${PATH}
  18. DoNotResuscitate commented on Jan 18, 2021

    @DoNotResuscitate

    So there is still no solution for using older Gradle versions?

  19. Bno93 commented on Jan 19, 2021

    @Bno93

    @atg22896: If you are using a gradle version below 4.7 the "workaround" is to stick with vscode-java v0.64.1 until you are able to update the gradle version.

  20. DoNotResuscitate commented on Jan 22, 2021

    @DoNotResuscitate

    @atg22896: If you are using a gradle version below 4.7 the "workaround" is to stick with vscode-java v0.64.1 until you are able to update the gradle version.

    So always use 0.64.1, got it. 😄 Sadly all my work projects use Gradle 2.X and it's not like I can make the whole company use an updated Gradle.

  21. H3nryM4 commented on Dec 29, 2021

    @H3nryM4

    If you are like me and don't like to upgrade java version just to keep using the extension this is a simple trick you can do. Go to extensions, settings then install version 0.64.1 which still works fine with java8

    image

    Does your VSCODE also display this interface every time you start it?
    屏幕截图 2021-12-30 000339

  22. jdneo commented on Jan 4, 2022

    @jdneo
    Collaborator

    @v-arc The latest Language Support for Java has embedded a JDK to launch itself, so there is no need to download another JDK11 to launch it. Please try the latest one and see if it works.

  23. H3nryM4 commented on Jan 4, 2022

    @H3nryM4

    @jdneo Great! I just upgraded Language Support for Java to version v1.2.0 and it worked without warning. Thanks!

  24. Bno93 commented on Jan 4, 2022

    @Bno93

    @v-arc The latest Language Support for Java has embedded a JDK to launch itself, so there is no need to download another JDK11 to launch it. Please try the latest one and see if it works.

    How about gradle support ?
    Do I need to update my projects gradle ?
    Because I need to stick with Gradle 4.0.2.

  25. jdneo commented on Jan 5, 2022

    @jdneo
    Collaborator

    @Bno93

    I think you can try to set the setting java.import.gradle.java.home, use it to point to your own JDK which is compatible with Gradle 4.0.2

  26. Bno93 commented on Jan 7, 2022

    @Bno93

    @jdneo seems find even without setting java.import.gradle.java.home. I've removed every generated files and folders and additionally cleared Java Language Server Workspace to make sure that I don't ran into problems opening fresh projects in the future.

  27. jdneo commented on Feb 8, 2022

    @jdneo
    Collaborator

    @testforstephen @rgrunber @fbricon We can consider to unpin this issue since we have embedded jre now

  28. unpinned this issue on Feb 8, 2022
  29. kqvanity commented on Jul 2, 2022

    @kqvanity

    On Linux, flatpacked vscode doesn't have access to the local JDK for instance.

    That was the culprit for me. The weird part thing is that, even when i host file system access to VScode, the application still couldn't access the root directory. I had to reinstall it using the prepackaged deb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions