diff --git a/extension/src/server/serverUtil.ts b/extension/src/server/serverUtil.ts index 6034627ab..c2746175a 100644 --- a/extension/src/server/serverUtil.ts +++ b/extension/src/server/serverUtil.ts @@ -1,4 +1,9 @@ -import { checkEnvJavaExecutable, findValidJavaHome, getRedHatJavaEmbeddedJRE } from "../util/config"; +import { + checkEnvJavaExecutable, + findValidJavaHome, + getConfigJavaImportGradleJavaHome, + getRedHatJavaEmbeddedJRE, +} from "../util/config"; export function getGradleServerCommand(): string { const platform = process.platform; @@ -16,7 +21,7 @@ export interface ProcessEnv { } export async function getGradleServerEnv(): Promise { - const javaHome = getRedHatJavaEmbeddedJRE() || (await findValidJavaHome()); + const javaHome = getConfigJavaImportGradleJavaHome() || getRedHatJavaEmbeddedJRE() || (await findValidJavaHome()); const env = { ...process.env }; if (javaHome) { Object.assign(env, { diff --git a/extension/src/util/config.ts b/extension/src/util/config.ts index f71cd6412..0e039d8a9 100644 --- a/extension/src/util/config.ts +++ b/extension/src/util/config.ts @@ -34,7 +34,7 @@ export function getJavaExecutablePathFromJavaHome(javaHome: string): string { } export async function findValidJavaHome(): Promise { - const javaHomeGetters = [getJdtlsConfigJavaHome, getConfigJavaHome, getConfigJavaImportGradleJavaHome]; + const javaHomeGetters = [getJdtlsConfigJavaHome, getConfigJavaHome]; let javaHome: string | undefined = undefined; let javaVersion = 0;