Skip to content

Commit 279bd6b

Browse files
Use project's Java runtime to launch the application (#758)
Signed-off-by: Jinbo Wang <[email protected]>
1 parent 5f15f9a commit 279bd6b

File tree

3 files changed

+7
-0
lines changed

3 files changed

+7
-0
lines changed

src/commands.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ export const JAVA_RESOLVE_BUILD_FILES = "vscode.java.resolveBuildFiles";
3636

3737
export const JAVA_IS_ON_CLASSPATH = "vscode.java.isOnClasspath";
3838

39+
export const JAVA_RESOLVE_JAVAEXECUTABLE = "vscode.java.resolveJavaExecutable";
40+
3941
export function executeJavaLanguageServerCommand(...rest) {
4042
// TODO: need to handle error and trace telemetry
4143
if (!utility.isJavaExtEnabled()) {

src/configurationProvider.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ export class JavaDebugConfigurationProvider implements vscode.DebugConfiguration
181181
});
182182
}
183183

184+
config.javaExec = await lsPlugin.resolveJavaExecutable(config.mainClass, config.projectName);
184185
// Add the default launch options to the config.
185186
config.cwd = config.cwd || _.get(folder, "uri.fsPath");
186187
} else if (config.request === "attach") {

src/languageServerPlugin.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,3 +96,7 @@ export async function isOnClasspath(uri: string): Promise<boolean> {
9696
return true;
9797
}
9898
}
99+
100+
export function resolveJavaExecutable(mainClass, projectName) {
101+
return commands.executeJavaLanguageServerCommand(commands.JAVA_RESOLVE_JAVAEXECUTABLE, mainClass, projectName);
102+
}

0 commit comments

Comments
 (0)