简体   繁体   English

Visual Studio Code 中的 Corda 支持问题

[英]issue with Corda support in Visual Studio Code

Corda supports in Visual Studio Code but Corda require only java 8 and not more than that like java 10, Corda 在 Visual Studio Code 中支持,但 Corda 只需要 java 8 而不会超过 java 10,

And VS Code requires java 10 or more than that, and Java Language Support is not supported java 8并且 VS Code 需要 java 10 或更高版本,并且不支持 Java 语言支持 java 8

like I am getting an issue like Couldn't start client Java Language Server, and another issue related issue.就像我遇到了一个问题,比如无法启动客户端 Java 语言服务器,以及另一个与问题相关的问题。

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...单独使用java 8,我能够构建或运行,但是它花费了很多时间,没有VS代码的任何java支持,它甚至没有在文件中显示错误......

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...当然,我添加了 java 8 和 java 10 版本,除了客户端 Java 语言服务器之外,我尝试了其他问题 java,例如 vs IntelliJ 代码建议等...

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"下面是我的“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 https://marketplace.visualstudio.com/items?itemName=R3.vscode-corda

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.一点背景知识:从 VSCode Redhat.java 扩展的 0.65 开始 - 需要安装 JDK 11 来初始化 Java 语言服务器。 Currently, Corda (and the Corda extension) only support JDK 1.8.目前,Corda(和 Corda 扩展)仅支持 JDK 1.8。

This limitation will be addressed in an upcoming version of the VSCode Corda extension.此限制将在即将发布的 VSCode Corda 扩展版本中解决。 In the meantime, there are two options to get the current extension working.同时,有两个选项可以使当前扩展正常工作。

Option 1.选项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 .您可以通过选择“Java 语言支持”上的齿轮并选择“安装其他版本”,通过扩展视图将语言服务器降级到 0.64.1。

安装另一个版本的扩展

Option 2.选项 2。

First, configure the settings.json as you have already done in VSCode - your entries look correct to me ;)首先,像您在 VSCode 中所做的那样配置 settings.json - 您的条目在我看来是正确的;)

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.此外,您还必须确保您的默认终端环境变量设置为 Java 8。这是因为内部 Corda 命令在集成终端中执行,“settings.json”对其不起作用。

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 .要在您的系统(Windows)上执行此操作,首先通过Control Panel -> System -> Advanced Settings -> Environment Variables -> System Variables将您的 java 路径从 11 更改为 1.8。 You want to delete the Oracle\\Java path entries that are shown in the screenshot and replace it with your JDK1.8 path+\\bin (eg C:\\Program Files\\Java\\jdk1.8.0_261\\bin);您想删除屏幕截图中显示的 Oracle\\Java 路径条目并将其替换为您的 JDK1.8 路径+\\bin(例如 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.如果这成功地工作,那么打开一个新的终端和 java -version 应该给你 1.8。

Windows 环境设置

Next you want to let VSCode access JDK 11. The language server will poll in order the following order:接下来要让 VSCode 访问 JDK 11。语言服务器将按以下顺序轮询:

  • the java.home setting in VS Code settings (workspace then user settings) VS Code 设置中的 java.home 设置(工作区然后是用户设置)
  • the JDK_HOME environment variable JDK_HOME 环境变量
  • the JAVA_HOME environment variable JAVA_HOME 环境变量
  • on the current system path在当前系统路径上

The easiest and least invasive is to use the java.home.最简单且侵入性最小的是使用 java.home。 Adding an entry such as "java.home": "C:\\Program Files\\Java\\jdk-11.0.8"添加条目,例如“java.home”:“C:\\Program Files\\Java\\jdk-11.0.8”

Hope this gets you up and running!希望这能让你启动并运行!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM