diff --git a/packages/metals-vscode/src/util.ts b/packages/metals-vscode/src/util.ts
index ca09c97a..fdc93724 100644
--- a/packages/metals-vscode/src/util.ts
+++ b/packages/metals-vscode/src/util.ts
@@ -116,10 +116,12 @@ export function getJavaVersionFromConfig() {
 }
 
 export function getJavaVersionOverride(): string | undefined {
-  return workspace
+  const javaVersion = workspace
     .getConfiguration("metals")
     .get<string>(UserConfiguration.MetalsJavaHome)
     ?.trim();
+  if (javaVersion && javaVersion.length > 0) return javaVersion;
+  else return undefined;
 }
 
 export async function fetchFrom(