Skip to content

Commit

Permalink
Fix: use import.gradle.java.home in prior (#1534)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jiaaming authored Jul 30, 2024
1 parent ff9ce62 commit 8400fdc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions extension/src/server/serverUtil.ts
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -16,7 +21,7 @@ export interface ProcessEnv {
}

export async function getGradleServerEnv(): Promise<ProcessEnv | undefined> {
const javaHome = getRedHatJavaEmbeddedJRE() || (await findValidJavaHome());
const javaHome = getConfigJavaImportGradleJavaHome() || getRedHatJavaEmbeddedJRE() || (await findValidJavaHome());
const env = { ...process.env };
if (javaHome) {
Object.assign(env, {
Expand Down
2 changes: 1 addition & 1 deletion extension/src/util/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export function getJavaExecutablePathFromJavaHome(javaHome: string): string {
}

export async function findValidJavaHome(): Promise<string | undefined> {
const javaHomeGetters = [getJdtlsConfigJavaHome, getConfigJavaHome, getConfigJavaImportGradleJavaHome];
const javaHomeGetters = [getJdtlsConfigJavaHome, getConfigJavaHome];
let javaHome: string | undefined = undefined;
let javaVersion = 0;

Expand Down

0 comments on commit 8400fdc

Please sign in to comment.