Skip to content

Commit 54438d5

Browse files
authored
update required tooling jre to 17 (#1009)
Signed-off-by: Yan Zhang <yanzh@microsoft.com>
1 parent a1f2a8e commit 54438d5

4 files changed

Lines changed: 10 additions & 8 deletions

File tree

src/beginner-tips/assets/tabs/FaqPanel.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { GenerateHeaderOptions } from "@microsoft/fast-foundation";
55
import { provideReactWrapper } from '@microsoft/fast-react-wrapper';
66
import * as webviewUI from "@vscode/webview-ui-toolkit";
77
import React from 'react';
8+
const REQUIRED_JDK_VERSION = 17;
89
const { wrap } = provideReactWrapper(React);
910
const DataGrid = wrap(webviewUI.VSCodeDataGrid);
1011
const DataRow = wrap(webviewUI.VSCodeDataGridRow);
@@ -51,12 +52,12 @@ export default function FaqPanel() {
5152

5253
<h2 className="font-weight-light">Why do I see the JDK errors?</h2>
5354
<p>
54-
<strong><code>JDK 11+</code> is required</strong> to run the Java language support (redhat.java) extension! You see this error because we failed to find one on your machine. The <a href="command:java.runtime">Configure Java Runtime</a> guide can help you understand how JDK path is searched and provides download links if you need to install one.
55+
<strong><code>JDK {REQUIRED_JDK_VERSION}+</code> is required</strong> to run the Java language support (redhat.java) extension! You see this error because we failed to find one on your machine. The <a href="command:java.runtime">Configure Java Runtime</a> guide can help you understand how JDK path is searched and provides download links if you need to install one.
5556
</p>
5657

5758
<h2 className="font-weight-light">Can I run my Java 8 project with JDK 1.8?</h2>
5859
<p>
59-
Yes. The JDK 11 requirement is just for running the Java language support (redhat.java) extension itself. You can still configure a different runtime <a href="command:java.helper.openUrl?%22https%3A%2F%2Fcode.visualstudio.com%2Fdocs%2Fjava%2Fjava-project%23_jdk-for-projects%22">JDK for your project</a> via the user setting <a href="command:workbench.action.openSettings?%22java.configuration.runtimes%22">"java.configuration.runtimes"</a>. The extension will pick a matching JDK to compile/run your project according to the compiler version specified by the project build file.
60+
Yes. The JDK {REQUIRED_JDK_VERSION} requirement is just for running the Java language support (redhat.java) extension itself. You can still configure a different runtime <a href="command:java.helper.openUrl?%22https%3A%2F%2Fcode.visualstudio.com%2Fdocs%2Fjava%2Fjava-project%23_jdk-for-projects%22">JDK for your project</a> via the user setting <a href="command:workbench.action.openSettings?%22java.configuration.runtimes%22">"java.configuration.runtimes"</a>. The extension will pick a matching JDK to compile/run your project according to the compiler version specified by the project build file.
6061
</p>
6162
<blockquote className="card-body">
6263
{runtimeSampleCode}

src/java-runtime/assets/ToolingJDKPanel.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { encodeCommandUriWithTelemetry } from '../../utils/webview';
88
import { JavaRuntimeEntry } from "../types";
99
import { onWillBrowseForJDK } from './vscode.api';
1010

11+
const REQUIRED_JDK_VERSION = 17;
1112
const { wrap } = provideReactWrapper(React);
1213
const Button = wrap(webviewUI.VSCodeButton);
1314

@@ -29,7 +30,7 @@ export class ToolingJDKPanel extends React.Component<Props, State> {
2930
return (
3031
<div className="container">
3132
<h1>Configure Runtime for Language Server</h1>
32-
<div className="warning-box"><i className="codicon codicon-warning"></i>Java Language Server requires a JDK 11+ to launch itself.</div>
33+
<div className="warning-box"><i className="codicon codicon-warning"></i>Java Language Server requires a JDK {REQUIRED_JDK_VERSION}+ to launch itself.</div>
3334

3435
{javaHomeError && (<p className="java-home-error">{javaHomeError}</p>)}
3536

src/java-runtime/index.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { getProjectNameFromUri, getProjectType } from "../utils/jdt";
1010
import { ProjectType } from "../utils/webview";
1111
import { JavaRuntimeEntry, ProjectRuntimeEntry } from "./types";
1212
import { sourceLevelDisplayName } from "./utils/misc";
13-
import { resolveRequirements } from "./utils/upstreamApi";
13+
import { REQUIRED_JDK_VERSION, resolveRequirements } from "./utils/upstreamApi";
1414

1515
let javaRuntimeView: vscode.WebviewPanel | undefined;
1616
let javaHomes: IJavaRuntime[];
@@ -195,7 +195,7 @@ export async function validateJavaRuntime() {
195195
// * option b) use the same way to check java_home as vscode-java
196196
try {
197197
const runtime = await resolveRequirements();
198-
if (runtime.tooling_jre_version >= 11 && runtime.tooling_jre) {
198+
if (runtime.tooling_jre_version >= REQUIRED_JDK_VERSION && runtime.tooling_jre) {
199199
return true;
200200
}
201201
} catch (error) {
@@ -227,8 +227,8 @@ export async function findJavaRuntimeEntries(): Promise<{
227227
const runtime = await resolveRequirements();
228228
javaDotHome = runtime.tooling_jre;
229229
const javaVersion = runtime.tooling_jre_version;
230-
if (!javaVersion || javaVersion < 11) {
231-
javaHomeError = `Java 11 or more recent is required by the Java language support (redhat.java) extension. Preferred JDK "${javaDotHome}" (version ${javaVersion}) doesn't meet the requirement. Please specify or install a recent JDK.`;
230+
if (!javaVersion || javaVersion < REQUIRED_JDK_VERSION) {
231+
javaHomeError = `Java ${REQUIRED_JDK_VERSION} or more recent is required by the Java language support (redhat.java) extension. Preferred JDK "${javaDotHome}" (version ${javaVersion}) doesn't meet the requirement. Please specify or install a recent JDK.`;
232232
}
233233
} catch (error) {
234234
javaHomeError = (error as Error).message;

src/java-runtime/utils/upstreamApi.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import * as vscode from "vscode";
1010
import { env, workspace } from 'vscode';
1111

1212
const expandHomeDir = require("expand-home-dir");
13-
const REQUIRED_JDK_VERSION = 11;
13+
export const REQUIRED_JDK_VERSION = 17;
1414

1515
export async function resolveRequirements(): Promise<{
1616
tooling_jre: string | undefined; // Used to launch Java extension.

0 commit comments

Comments
 (0)