VS Code 需要 Java 11,但 Azure Functions 需要 Java 8 – 如何修改 settings.json

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

VS Code required Java 11, but Azure Functions require Java 8 - How to modify settings.json

问题

Starting July Java 11 was required for Visual Studio Code. So I have installed Java 11.
从七月开始,Visual Studio Code 需要 Java 11。所以我已安装了 Java 11。

But Azure Function requires Java 8. I tried to configure VS to use both SDK.
但 Azure Function 需要 Java 8。我尝试配置 VS 以同时使用两个 SDK。

Example: https://stackoverflow.com/questions/63043585/vscode-showing-java-11-or-more-recent-is-required-to-run-please-download-and-i
示例:https://stackoverflow.com/questions/63043585/vscode-showing-java-11-or-more-recent-is-required-to-run-please-download-and-i

VS Code still trying to use Java 11. Is it possible to change to JDK 8???
VS Code 仍然尝试使用 Java 11。是否可能更改为 JDK 8?

[WARNING] Azure Functions only support JDK 8, which is lower than local JDK version 11.0.8.
[警告] Azure Functions 仅支持 JDK 8,低于本地 JDK 版本 11.0.8。

JAVA_HOME env path
JAVA_HOME 环境变量路径

C:\Program Files\Zulu\zulu-11\

Settings.json for JAVA.HOME
JAVA.HOME 的 Settings.json 文件

{
"azureFunctions.deploySubpath": "target/azure-functions/functionsjava",
"azureFunctions.projectLanguage": "Java",
"azureFunctions.projectRuntime": "~2",
"debug.internalConsoleOptions": "neverOpen",
"azureFunctions.preDeployTask": "package",
"java.configuration.updateBuildConfiguration": "interactive",
"azureFunctions.templateFilter": "All",
"java.home": "C:/Program Files/Zulu/zulu-11",
"java.configuration.runtimes": [
{
"name": "JavaSE-1.8",
"path": "C:/Program Files/Zulu/zulu-8",
"default": true
},
{
"name": "JavaSE-11",
"path": "C:/Program Files/Zulu/zulu-11"
}
]
}

英文:

Starting July Java 11 was required for Visual Studio Code. So I have installed Java 11.
But Azure Function requires Java 8. I tried to configure VS to use both SDK.

Example: https://stackoverflow.com/questions/63043585/vscode-showing-java-11-or-more-recent-is-required-to-run-please-download-and-i

VS Code still trying to use Java 11. Is it possible to change to JDK 8???
[WARNING] Azure Functions only support JDK 8, which is lower than local JDK version 11.0.8.

JAVA_HOME env path

C:\Program Files\Zulu\zulu-11\

Settings.json for JAVA.HOME

{
  "azureFunctions.deploySubpath": "target/azure-functions/functionsjava",
  "azureFunctions.projectLanguage": "Java",
  "azureFunctions.projectRuntime": "~2",
  "debug.internalConsoleOptions": "neverOpen",
  "azureFunctions.preDeployTask": "package",
  "java.configuration.updateBuildConfiguration": "interactive",
  "azureFunctions.templateFilter": "All",
  "java.home": "C:/Program Files/Zulu/zulu-11",
  "java.configuration.runtimes": [
    {
      "name": "JavaSE-1.8",
      "path": "C:/Program Files/Zulu/zulu-8",
     "default": true
    },
    {
      "name": "JavaSE-11",
      "path": "C:/Program Files/Zulu/zulu-11",
  
    }
  ]
}

答案1

得分: 1

如果您想使用jdk 8,那么您应该这样做:

"java.home":"C:\\Program Files\\Java\\jdk1.8.0_261",

顺便说一下,Azure函数支持java 11,但您需要使用v3版本的函数:

https://learn.microsoft.com/en-us/azure/azure-functions/functions-reference-java?tabs=consumption#supported-versions

英文:

If you want to use jdk 8, then you should do like this:

"java.home":"C:\\Program Files\\Java\\jdk1.8.0_261",

By the way, azure function support java 11, but you need you use function v3:

https://learn.microsoft.com/en-us/azure/azure-functions/functions-reference-java?tabs=consumption#supported-versions

huangapple
  • 本文由 发表于 2020年8月13日 21:39:37
  • 转载请务必保留本文链接:https://go.coder-hub.com/63396467.html
匿名

发表评论

匿名网友

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

确定