Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions scripts/launcher.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
@echo off

REM Change code page to UTF-8 for better compatibility.
@chcp.com 65001 > NUL

REM Execute real command passed by args
%*
4 changes: 4 additions & 0 deletions src/configurationProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,10 @@ export class JavaDebugConfigurationProvider implements vscode.DebugConfiguration
config.shortenCommandLine = await detectLaunchCommandStyle(config);
}

if (process.platform === "win32" && config.request === "launch" && config.console !== "internalConsole") {
config.launcherScript = utility.getLauncherScriptPath();
}

const debugServerPort = await lsPlugin.startDebugSession();
if (debugServerPort) {
config.debugServer = debugServerPort;
Expand Down
7 changes: 7 additions & 0 deletions src/utility.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.

import * as path from "path";
import * as vscode from "vscode";
import { setUserError } from "vscode-extension-telemetry-wrapper";
import { logger, Type } from "./logger";

const TROUBLESHOOTING_LINK = "https://github.com/Microsoft/vscode-java-debug/blob/master/Troubleshooting.md";
const LEARN_MORE = "Learn More";
const JAVA_EXTENSION_ID = "redhat.java";
const DEBUGGER_EXTENSION_ID = "vscjava.vscode-java-debug";

export class UserError extends Error {
public context: ITroubleshootingMessage;
Expand Down Expand Up @@ -158,3 +160,8 @@ export function isJavaExtEnabled(): boolean {
const javaExt = vscode.extensions.getExtension(JAVA_EXTENSION_ID);
return !!javaExt;
}

export function getLauncherScriptPath() {
const ext = vscode.extensions.getExtension(DEBUGGER_EXTENSION_ID);
return path.join(ext.extensionPath, "scripts", "launcher.bat");
}