From 53f04ba280f92dcc27d78f4485b1772fd72a5d4b Mon Sep 17 00:00:00 2001 From: David Thompson Date: Thu, 9 Jan 2025 11:00:51 -0500 Subject: [PATCH] Require Java 11 lemminx is moving to Java 11, so this PR ensures that a Java 11 JRE/JDK is used to run lemminx (or uses the binary if Java 11 is not installed). This PR also updates the documentation to reflect the new Java 11 requirement. It also updates the documentation related to instructions on setting up GraalVM for locally building the binary. Signed-off-by: David Thompson --- CONTRIBUTING.md | 5 ++--- README.md | 8 ++++---- docs/Preferences.md | 2 +- package-lock.json | 4 ++-- package.json | 4 ++-- src/server/requirements.ts | 5 +++-- src/server/serverStarter.ts | 2 +- 7 files changed, 15 insertions(+), 15 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e3ff1ddd..cc3586fc 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -8,7 +8,7 @@ Contributions are essential for keeping this extension great. We try to keep it * latest [Visual Studio Code](https://code.visualstudio.com/) * [Node.js](https://nodejs.org/) v4.0.0 or higher - * [JDK 8+](http://www.oracle.com/technetwork/java/javase/downloads/index.html) + * [JDK 11+](http://www.oracle.com/technetwork/java/javase/downloads/index.html) * [Maven](https://maven.apache.org/) ### Steps @@ -118,8 +118,7 @@ If you submit a LemMinX PR, GitHub Actions will generate a binary for your PR th If you need to generate a LemMinX binary locally for whatever reason, follow these steps: 1. Download and set up [GraalVM and its dependencies](https://www.graalvm.org/docs/getting-started/) - * either 20.x or 21.x should work - * The version for Java 11 is preferred, since it is hard to set up GraalVM Java 8 on Windows + * The latest version should work 2. Make sure that the environment variable `JAVA_HOME` points to the GraalVM installation. 3. Run `./mvnw clean package -DskipTests -Dnative` from the root of the LemMinX repository * This will use a lot of memory (> 4 GB) and take a while diff --git a/README.md b/README.md index 4321878d..44d10ab0 100644 --- a/README.md +++ b/README.md @@ -58,18 +58,18 @@ or you can read this documentation inside vscode with the command `Open XML Docu For running the binary version: * Windows, macOS, or Linux, on a x86_64 CPU - * We do not currently support running on Linux installations without `libc` present + * ~~We do not currently support running on Linux installations without `libc` present~~ See [#1016](https://github.com/redhat-developer/vscode-xml/pull/1016) * Java is not required for this version * The binary is automatically downloaded by vscode-xml if it is needed, with no additional action required on the part of the user. For running the Java version (required if you want to run [extensions](./docs/Extensions.md#custom-xml-extensions) to the base XML features): - * Java JDK (or JRE) 8 or more recent + * Java JDK (or JRE) 11 or more recent * Ensure Java path is set in either: * `xml.java.home` in VSCode preferences * `java.home` in VSCode preferences * Environment variable `JAVA_HOME` or `JDK_HOME` * **Note**: The path should end at the parent folder that contains the `bin` folder. - **Example Path**: `/usr/lib/jvm/java-1.8.0` if `bin` exists at `/usr/lib/jvm/java-1.8.0/bin`. + **Example Path**: `/usr/lib/jvm/jre-11` if `bin` exists at `/usr/lib/jvm/jre-11/bin`. * **Note**: If the path is not set, the extension will attempt to find the path to the JDK or JRE. See [how to set java home](https://github.com/redhat-developer/vscode-xml/blob/main/docs/Preferences.md#java-home) for more information how this extension searches for Java. @@ -78,7 +78,7 @@ See [how to set java home](https://github.com/redhat-developer/vscode-xml/blob/m The following settings are supported: -* [`xml.java.home`](https://github.com/redhat-developer/vscode-xml/blob/main/docs/Preferences.md#java-home): Specifies the folder path to the JDK (8 or more recent) used to launch the XML Language Server if the Java server is being run. If not set, falls back to either the `java.home` preference or the `JAVA_HOME` or `JDK_HOME` environment variables. +* [`xml.java.home`](https://github.com/redhat-developer/vscode-xml/blob/main/docs/Preferences.md#java-home): Specifies the folder path to the JDK (11 or more recent) used to launch the XML Language Server if the Java server is being run. If not set, falls back to either the `java.home` preference or the `JAVA_HOME` or `JDK_HOME` environment variables. * [`xml.server.vmargs`](https://github.com/redhat-developer/vscode-xml/blob/main/docs/Preferences.md#server-vm-arguments): Specifies extra VM arguments used to launch the XML Language Server. Eg. use `-Xmx1G -XX:+UseG1GC -XX:+UseStringDeduplication` to bypass class verification, increase the heap size to 1GB and enable String deduplication with the G1 Garbage collector. * [`xml.server.workDir`](https://github.com/redhat-developer/vscode-xml/blob/main/docs/Preferences.md#server-cache-path): Set a custom folder path for cached XML Schemas. An absolute path is expected, although the `~` prefix (for the user home directory) is supported. Default is `~/.lemminx`. diff --git a/docs/Preferences.md b/docs/Preferences.md index ad68ce0b..9dcf061c 100644 --- a/docs/Preferences.md +++ b/docs/Preferences.md @@ -12,7 +12,7 @@ * An environment variable `JAVA_HOME` or `JDK_HOME` Please note: - * The path should end at the parent folder that contains the bin folder. As an example, use `/usr/lib/jvm/java-1.8.0` if the bin folder exists at `/usr/lib/jvm/java-1.8.0/bin`. + * The path should end at the parent folder that contains the bin folder. As an example, use `/usr/lib/jvm/jre-11` if the bin folder exists at `/usr/lib/jvm/jre-11/bin`. * If the path is not set, the extension will attempt to find the path to the JDK or JRE. ## Server VM Arguments diff --git a/package-lock.json b/package-lock.json index a2fb438b..873630c4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "vscode-xml", - "version": "0.27.3", + "version": "0.28.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "vscode-xml", - "version": "0.27.3", + "version": "0.28.0", "license": "EPL-2.0", "dependencies": { "@redhat-developer/vscode-redhat-telemetry": "^0.9.1", diff --git a/package.json b/package.json index c8bdcc5c..93803070 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "vscode-xml", "displayName": "XML", "description": "XML Language Support by Red Hat", - "version": "0.27.3", + "version": "0.28.0", "author": "Red Hat", "publisher": "redhat", "icon": "icons/icon128.png", @@ -160,7 +160,7 @@ "null" ], "default": null, - "markdownDescription": "Specifies the folder path to the JDK (8 or more recent) used to launch the XML Language Server if the Java server is being run.\nOn Windows, backslashes must be escaped, i.e.\n`\"xml.java.home\": \"C:\\\\Program Files\\\\Java\\\\jdk1.8.0_161\"`. For more information, please refer to [this document](command:xml.open.docs?%5B%7B%22page%22%3A%22Preferences%22%2C%22section%22%3A%22java-home%22%7D%5D).", + "markdownDescription": "Specifies the folder path to the JDK (11 or more recent) used to launch the XML Language Server if the Java server is being run.\nOn Windows, backslashes must be escaped, i.e.\n`\"xml.java.home\": \"C:\\\\Program Files\\\\Java\\\\jdk11\"`. For more information, please refer to [this document](command:xml.open.docs?%5B%7B%22page%22%3A%22Preferences%22%2C%22section%22%3A%22java-home%22%7D%5D).", "scope": "window" }, "xml.server.vmargs": { diff --git a/src/server/requirements.ts b/src/server/requirements.ts index b04809a7..d3b7fe4d 100644 --- a/src/server/requirements.ts +++ b/src/server/requirements.ts @@ -128,6 +128,7 @@ function sortJdksBySource(jdks: IJavaRuntime[]) { } } rankedJdks.filter(jdk => jdk.rank === undefined).forEach(jdk => jdk.rank = sources.length); + rankedJdks.filter(jdk => jdk.version.major >= 11); rankedJdks.sort((a, b) => a.rank - b.rank); } @@ -151,8 +152,8 @@ function checkJavaVersion(java_home: string): Promise { return new Promise((resolve, reject) => { cp.execFile(java_home + '/bin/java', ['-version'], {}, (error, stdout, stderr) => { const javaVersion = parseMajorVersion(stderr); - if (javaVersion < 8) { - reject(openJDKDownload('Java 8 or more recent is required to run. Please download and install a recent Java runtime.')); + if (javaVersion < 11) { + reject(openJDKDownload('Java 11 or more recent is required to run. Please download and install a recent Java runtime.')); } else { resolve(javaVersion); diff --git a/src/server/serverStarter.ts b/src/server/serverStarter.ts index d9b887f7..0cfbb9f8 100644 --- a/src/server/serverStarter.ts +++ b/src/server/serverStarter.ts @@ -32,7 +32,7 @@ export async function prepareExecutable( const CONFIGURE_JAVA = 'More Info'; const DISABLE_WARNING = 'Disable Warning'; window.showInformationMessage('Extensions to the XML language server were detected, but no Java was found. ' - + 'In order to use these extensions, please install and configure a Java runtime (Java 8 or more recent).', + + 'In order to use these extensions, please install and configure a Java runtime (Java 11 or more recent).', DOWNLOAD_JAVA, CONFIGURE_JAVA, DISABLE_WARNING) .then((selection: string) => { if (selection === DOWNLOAD_JAVA) {