From 738b2c9fc32b517c6061174fec4486fe4cf1ef32 Mon Sep 17 00:00:00 2001 From: Yan Zhang Date: Thu, 19 Nov 2020 15:28:37 +0800 Subject: [PATCH 1/2] fallback to search /usr/lib/jvm for jdks on Linux Signed-off-by: Yan Zhang --- src/findJavaRuntimes.ts | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/findJavaRuntimes.ts b/src/findJavaRuntimes.ts index 7886dfaee3..9e9a011b8e 100644 --- a/src/findJavaRuntimes.ts +++ b/src/findJavaRuntimes.ts @@ -10,6 +10,7 @@ const expandHomeDir = require("expand-home-dir"); const WinReg = require("winreg-utf8"); const isWindows: boolean = process.platform.indexOf("win") === 0; const isMac: boolean = process.platform.indexOf("darwin") === 0; +const isLinux: boolean = process.platform.indexOf("linux") === 0; const JAVAC_FILENAME = "javac" + (isWindows ? ".exe" : ""); const JAVA_FILENAME = "java" + (isWindows ? ".exe" : ""); @@ -236,6 +237,24 @@ async function fromCommonPlaces(): Promise { } } + // common place for Linux + if (isLinux) { + const jvmStore = "/usr/lib/jvm"; + let jvms: string[] = []; + try { + jvms = await fse.readdir(jvmStore); + } catch (error) { + // ignore + } + for (const jvm of jvms) { + const proposed = path.join(jvmStore, jvm); + const javaHome = await verifyJavaHome(proposed, JAVAC_FILENAME); + if (javaHome) { + ret.push(javaHome); + } + } + } + return ret; } From 3780149775619a913616f257c2d0aa7203058103 Mon Sep 17 00:00:00 2001 From: Yan Zhang Date: Thu, 19 Nov 2020 15:42:12 +0800 Subject: [PATCH 2/2] update changelog Signed-off-by: Yan Zhang --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9689efd640..ffe4243a9a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ * bug fix - Quarkus: generated sources are not accessible. See [#1675](https://github.com/redhat-developer/vscode-java/issues/1675) * bug fix - Error in every java file after updating to macOS Big Sur. See [#1700](https://github.com/redhat-developer/vscode-java/issues/1700). * bug fix - Fix jdk detection: cover symlink folder on Linux. See [#1704](https://github.com/redhat-developer/vscode-java/pull/1704). + * bug fix - Fix jdk detection: cover common JDK installation places on Linux. See [#1706](https://github.com/redhat-developer/vscode-java/pull/1706). * other - Improve tracing capability of m2e through m2e.logback.configuration.. See [JLS#1589](https://github.com/eclipse/eclipse.jdt.ls/pull/1589). * other - Infer expressions if there is no selection range when extracting method. See [#1680](https://github.com/redhat-developer/vscode-java/pull/1680).