问题与Visual Studio Code中Corda支持有关。

huangapple go评论87阅读模式
英文:

issue with Corda support in Visual Studio Code

问题

Corda 在 Visual Studio Code 中提供支持,但 Corda 只需要 Java 8,不支持比 Java 10 更高版本。

而 VS Code 需要 Java 10 或更高版本,并且不支持 Java 8 的语言支持。

我遇到了一个问题,无法启动客户端的 Java Language Server,还有另一个相关问题。

只有使用 Java 8,我能够构建或运行,但是花费了很多时间,没有任何 VS Code 的 Java 支持,甚至文件中都不显示错误...

当然,我添加了 Java 8 和 Java 10 版本,我尝试了其他问题,比如使用 IntelliJ 提示的 Java,除了客户端的 Java Language Server...

同时在这两个版本中,我无法完成构建、运行,甚至无法进入节点浏览器。构建需要很长时间(没有抛出任何问题),节点浏览器报网络问题,但是没有日志(网络没有任何限制,我在不同的网络中尝试过,甚至在不同的机器上尝试过)

以下是我的 "setting.json" 文件:

"[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,
    ...
    // (其他配置)
    ...
    "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.*"
    ]
}
...
(其他配置)
...

你可以在这里找到 Corda 的 VS Code 插件:https://marketplace.visualstudio.com/items?itemName=R3.vscode-corda

英文:

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

得分: 3

以下是您要翻译的内容:

背景简介: 从 VSCode Redhat.java 扩展的版本 0.65 开始,需要安装 JDK 11 才能初始化 Java 语言服务器。目前,Corda(以及 Corda 扩展)仅支持 JDK 1.8。

这个限制将在即将推出的 VSCode Corda 扩展的版本中得以解决。与此同时,有两种方法可以让当前的扩展继续工作。

选项 1.

您可以通过扩展视图将语言服务器降级到 0.64.1,方法是选择“Language Support for Java”上的齿轮图标,然后选择Install Another Versions

选项 2.

首先,像您在 VSCode 中已经做过的那样,在 settings.json 中进行配置 - 您的条目看起来对我来说是正确的 问题与Visual Studio Code中Corda支持有关。

此外,您还必须确保您的默认终端环境变量设置为 Java 8。这是因为内部 Corda 命令在集成终端中执行,在该终端上,“settings.json”不起作用。

要在您的系统(Windows)上执行此操作,首先通过控制面板 -> 系统 -> 高级设置 -> 环境变量 -> 系统变量将您的 Java 路径从 11 更改为 1.8。您需要删除屏幕截图中显示的 Oracle\Java 路径条目,并将其替换为您的 JDK1.8 路径+\bin(例如 C:\Program Files\Java\jdk1.8.0_261\bin);如果这成功运行,那么在一个新的终端中运行 java -version 应该会显示 1.8。

接下来,您需要让 VSCode 访问 JDK 11。语言服务器将按以下顺序轮询:

  • VS Code 设置中的 java.home 设置(工作区设置然后是用户设置)
  • JDK_HOME 环境变量
  • JAVA_HOME 环境变量
  • 当前系统路径上的

最简单且最不侵入性的方法是使用 java.home。添加一个条目,如:"java.home": "C:\Program Files\Java\jdk-11.0.8"

希望这可以帮助您开始运行!

英文:

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.

问题与Visual Studio Code中Corda支持有关。

Option 2.

First, configure the settings.json as you have already done in VSCode - your entries look correct to me 问题与Visual Studio Code中Corda支持有关。

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.

问题与Visual Studio Code中Corda支持有关。

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!

huangapple
  • 本文由 发表于 2020年10月15日 15:48:09
  • 转载请务必保留本文链接:https://go.coder-hub.com/64367047.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定