From 2267d86f031a9981ff402adc1fbb88168f0961f8 Mon Sep 17 00:00:00 2001 From: Thorsten Muerell Date: Wed, 8 Nov 2017 15:36:51 +0100 Subject: [PATCH] Configure Java Home --- package.json | 15 +++++++++++++-- src/sessionmanager.ts | 8 +++++++- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 3f7928a..e9198ce 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "frog", "displayName": "frog", "description": "The Oracle SQL workbench for VSCode", - "version": "0.0.15", + "version": "0.0.16", "publisher": "todie", "engines": { "vscode": "^1.17.0" @@ -73,7 +73,18 @@ "scopeName": "code.log", "path": "./syntaxes/frog-runner.tmLanguage" } - ] + ], + "configuration": { + "type": "object", + "title": "Frog configuration", + "properties": { + "frog.javaHome": { + "type": "string", + "default": false, + "description": "Set the java home to use for the runner." + } + } + } }, "scripts": { "vscode:prepublish": "npm run compile", diff --git a/src/sessionmanager.ts b/src/sessionmanager.ts index 61a1dcb..cdc4e1d 100644 --- a/src/sessionmanager.ts +++ b/src/sessionmanager.ts @@ -2,6 +2,7 @@ import * as vscode from 'vscode'; import { ConnectionNode } from './connections' import { spawn } from 'child_process' import { TextDocumentContentProvider } from './resultsetview' +import * as path from 'path' const extensionName = "frog"; const previewUri = vscode.Uri.parse('frog-view://authority/resultset'); @@ -59,7 +60,12 @@ export class SessionManager { } let extPath = vscode.extensions.getExtension("todie.frog").extensionPath; - this.dbSession = spawn("java", ['-jar', extPath + '/frog-runner.jar', this.currentConnection.host, this.currentConnection.port.toString(), this.currentConnection.schema, this.currentConnection.username, this.currentConnection.password]); + let javaHome = vscode.workspace.getConfiguration('frog').get("frog.javaHome", "") + let java = "java"; + if (javaHome) { + java = path.join(javaHome, 'bin', 'java') + } + this.dbSession = spawn(java, ['-jar', extPath + '/frog-runner.jar', this.currentConnection.host, this.currentConnection.port.toString(), this.currentConnection.schema, this.currentConnection.username, this.currentConnection.password]); let outputBuffer = "";