Skip to content

Commit 74b7018

Browse files
committed
Ability to set the Java version in the VS Code settings
Signed-off-by: worksofliam <[email protected]>
1 parent 5adafbe commit 74b7018

File tree

3 files changed

+35
-1
lines changed

3 files changed

+35
-1
lines changed

package.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,21 @@
6262
"description": "Saved configs for",
6363
"default": {},
6464
"additionalProperties": true
65+
},
66+
"vscode-db2i.jobJava": {
67+
"type": "string",
68+
"description": "Java version for Server Component",
69+
"default": "/QOpenSys/QIBM/ProdData/JavaVM/jdk80/64bit/bin/java",
70+
"enum": [
71+
"/QOpenSys/QIBM/ProdData/JavaVM/jdk80/64bit/bin/java",
72+
"/QOpenSys/QIBM/ProdData/JavaVM/jdk17/64bit/bin/java",
73+
"/QOpenSys/QIBM/ProdData/JavaVM/jdk21/64bit/bin/java"
74+
],
75+
"enumDescriptions": [
76+
"Java 8 (system default)",
77+
"Java 17",
78+
"Java 21"
79+
]
6580
}
6681
}
6782
},

src/connection/serverComponent.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@ import { SERVER_VERSION_FILE } from "./SCVersion";
1010
import IBMi from "@halcyontech/vscode-ibmi-types/api/IBMi";
1111
import * as Crypto from 'crypto';
1212
import { readFileSync } from "fs";
13+
import Configuration from "../configuration";
1314

1415
const ExecutablePathDir = `$HOME/.vscode/`;
16+
const DEFAULT_JAVA_EIGHT = `/QOpenSys/QIBM/ProdData/JavaVM/jdk80/64bit/bin/java`;
1517

1618
export enum UpdateStatus {
1719
FAILED,
@@ -50,8 +52,10 @@ export class ServerComponent {
5052
static getInitCommand(): string | undefined {
5153
const path = this.getComponentPath();
5254

55+
const jvmVersion = Configuration.get<string>(`jobJava`) || DEFAULT_JAVA_EIGHT;
56+
5357
if (path) {
54-
return `/QOpenSys/QIBM/ProdData/JavaVM/jdk80/64bit/bin/java -Dos400.stdio.convert=N -jar ${path} --single`
58+
return `${jvmVersion} -Dos400.stdio.convert=N -jar ${path} --single`
5559
}
5660
}
5761

src/contributes.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,21 @@
2121
"description": "Saved configs for",
2222
"default": {},
2323
"additionalProperties": true
24+
},
25+
"vscode-db2i.jobJava": {
26+
"type": "string",
27+
"description": "Java version for Server Component",
28+
"default": "/QOpenSys/QIBM/ProdData/JavaVM/jdk80/64bit/bin/java",
29+
"enum": [
30+
"/QOpenSys/QIBM/ProdData/JavaVM/jdk80/64bit/bin/java",
31+
"/QOpenSys/QIBM/ProdData/JavaVM/jdk17/64bit/bin/java",
32+
"/QOpenSys/QIBM/ProdData/JavaVM/jdk21/64bit/bin/java"
33+
],
34+
"enumDescriptions": [
35+
"Java 8 (system default)",
36+
"Java 17",
37+
"Java 21"
38+
]
2439
}
2540
}
2641
},

0 commit comments

Comments
 (0)