1
votes

Corda supports in Visual Studio Code but Corda require only java 8 and not more than that like java 10,

And VS Code requires java 10 or more than that, and Java Language Support is not supported java 8

like I am getting an issue like Couldn't start client Java Language Server, and another issue related issue.

with java 8 alone, I was able to build or run, but it was taking much time, without any java supports of VS code, it is not even showing errors in the file...

Of course, I added both java 8 and java 10 version, I tried other issue java like vs IntelliJ code suggest, etc except client Java Language Server...

Also with both versions, I am not able to complete the flow of build, run, up to node explorer. build taking much time, (not throwing any issue), and node explorer throwing network issue, but no logs found (network is not restricting in any way, tried it in a different network, tried it in the different machine also)

below is my "setting.json"

Not sure what is the problem

"[json]": {
    "editor.quickSuggestions": {
        "strings": true
    },
    "editor.suggest.insertMode": "replace"
},
"terminal.integrated.shellArgs.windows": ["-ExecutionPolicy", "Bypass"],
"workbench.editor.enablePreview": false,
"editor.suggestSelection": "first",
"java.configuration.runtimes": [
    {
        "name": "JavaSE-1.8",
        "path": "C:\\Program Files\\Java\\jdk1.8.0_221",
        "sources" : "C:\\Program Files\\Java\\jdk1.8.0_221\\src.zip",
        "default": true
    }
    ,
    {
      "name": "JavaSE-11",
      "path": "C:\\Program Files\\Java\\jdk-11.0.6",
      "sources" : "C:\\Program Files\\Java\\jdk-11.0.6\\lib\\src.zip",
      "javadoc" : "https://docs.oracle.com/en/java/javase/11/docs/api",
     }
],
"vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue",
"java.home": "C:\\Program Files\\Java\\jdk-11.0.6",
"[java]": {
    "breadcrumbs.showClasses": true,
    "outline.showMethods": true,
    "outline.showPackages": true,
    "outline.showInterfaces": true,
    "outline.showFunctions": true,
    "editor.suggestSelection": "first",
    "outline.showProperties": true,
    "outline.showVariables": true,
    "editor.suggest.showValues": true,
    "editor.suggest.showSnippets": true,
    "editor.suggest.showClasses": true,
    "editor.quickSuggestions": {
        "other": true,
        "comments": false,
        "strings": false
    },
    "editor.suggest.snippetsPreventQuickSuggestions": false,
    "editor.suggest.showFiles": true,
    "breadcrumbs.showFunctions": true,
    "breadcrumbs.showProperties": true,
    "breadcrumbs.showVariables": true,
    "breadcrumbs.showObjects": true
},
"java.configuration.checkProjectSettingsExclusions": false,
"java.classPath": [
    "lib/quasar.jar"
],
"files.associations": {
    "*.java": "java"
},
"java.completion.guessMethodArguments": true,
"java.implementationsCodeLens.enabled": true,
"java.referencesCodeLens.enabled": true,
"java.trace.server": "verbose",
"terminal.integrated.shell.windows": "C:\\Windows\\System32\\cmd.exe",
"tabnine.experimentalAutoImports": true,
"javascript.updateImportsOnFileMove.enabled": "always",
"diffEditor.ignoreTrimWhitespace": true,
"diffEditor.renderSideBySide": true,
"java.completion.favoriteStaticMembers": [
    "org.junit.Assert.*",
    "org.junit.Assume.*",
    "org.junit.jupiter.api.Assertions.*",
    "org.junit.jupiter.api.Assumptions.*",
    "org.junit.jupiter.api.DynamicContainer.*",
    "org.junit.jupiter.api.DynamicTest.*",
    "org.mockito.Mockito.*",
    "org.mockito.ArgumentMatchers.*",
    "org.mockito.Answers.*"
]

https://marketplace.visualstudio.com/items?itemName=R3.vscode-corda

1

1 Answers

3
votes

A bit of background: Starting with 0.65 of the VSCode Redhat.java extension - it is required that JDK 11 be installed to initialize the Java language server. Currently, Corda (and the Corda extension) only support JDK 1.8.

This limitation will be addressed in an upcoming version of the VSCode Corda extension. In the meantime, there are two options to get the current extension working.

Option 1.

You can downgrade the language server to 0.64.1 through the extensions view by selecting the gear on "Language Support for Java" and selecting Install Another Versions.

Installing another version of an extension

Option 2.

First, configure the settings.json as you have already done in VSCode - your entries look correct to me ;)

Additionally, you must also make sure your default terminal environment variable is set to Java 8. This is because the internal Corda commands execute in an integrated terminal on which 'settings.json' does not have an effect.

To do this on your system (windows) first change your java path from 11 to 1.8 through Control Panel -> System -> Advanced Settings -> Environment Variables -> System Variables. You want to delete the Oracle\Java path entries that are shown in the screenshot and replace it with your JDK1.8 path+\bin (e.g. C:\Program Files\Java\jdk1.8.0_261\bin); if this successfully works, then opening a fresh terminal and java -version should give you 1.8.

windows env settings

Next you want to let VSCode access JDK 11. The language server will poll in order the following order:

  • the java.home setting in VS Code settings (workspace then user settings)
  • the JDK_HOME environment variable
  • the JAVA_HOME environment variable
  • on the current system path

The easiest and least invasive is to use the java.home. Adding an entry such as "java.home": "C:\Program Files\Java\jdk-11.0.8"

Hope this gets you up and running!