adashen / vscode-tomcat

Other
65 stars 35 forks source link

ER : use the java.home property in place of JAVA_HOME defined at system level #156

Open ruffinalex opened 6 years ago

ruffinalex commented 6 years ago

Hello,

I made a modification in local to change the java executable used to launch tomcat executables. I take into account the java.home property defined in the java extension (Red Hat) to specify the path of the java executable.

I cannot push into the repository my update (not allowed) but I propose you the diff on src/Tomcat/TomcatController.ts :+1: @@ -20,8 +20,12 @@ import { WarPackage } from "./WarPackage";

export class TomcatController { constructor(private _tomcatModel: TomcatModel, private _extensionPath: string) { let configuration = vscode.workspace.getConfiguration('java') ; this.javaExec = configuration.get('home') + '/bin/java' ; }

private javaExec: string ;

public async deleteServer(tomcatServer: TomcatServer): Promise<void> {
    const server: TomcatServer = await this.precheck(tomcatServer);
    if (server) {

@ -155,7 +159,7 @@ export class TomcatController { return; } Utility.trackTelemetryStep(restart ? 'restart' : 'stop'); await Utility.executeCMD(server.outputChannel, 'java', { shell: true }, ...server.jvmOptions.concat('stop')); await Utility.executeCMD(server.outputChannel, this.javaExec, { shell: true }, ...server.jvmOptions.concat('stop')); if (!restart) { server.clearDebugInfo(); } @ -344,7 +348,9 @@ export class TomcatController { startArguments = [${Constants.DEBUG_ARGUMENT_KEY}${serverInfo.getDebugPort()}].concat(startArguments); } startArguments.push('start'); const javaProcess: Promise = Utility.executeCMD(serverInfo.outputChannel, 'java', { shell: true }, ...startArguments);

        const javaProcess: Promise<void> = Utility.executeCMD(serverInfo.outputChannel, this.javaExec, { shell: true }, ...startArguments);
        serverInfo.setStarted(true);
        this.startDebugSession(serverInfo);
        await javaProcess;

I hope it could help this cool extension for java developpers ;-)

Best regards

Alex

addy commented 6 years ago

@ruffinalex Can you not fork this repo?

orsolli commented 4 years ago

277