mirror of
https://github.com/corda/corda.git
synced 2025-01-18 02:39:51 +00:00
CORDA-1633 - Check Java version before launch (#4128)
This commit is contained in:
parent
ff9061b968
commit
199a20398c
@ -54,6 +54,7 @@ public class CordaCaplet extends Capsule {
|
||||
|
||||
@Override
|
||||
protected ProcessBuilder prelaunch(List<String> jvmArgs, List<String> args) {
|
||||
checkJavaVersion();
|
||||
nodeConfig = parseConfigFile(args);
|
||||
return super.prelaunch(jvmArgs, args);
|
||||
}
|
||||
@ -143,6 +144,14 @@ public class CordaCaplet extends Capsule {
|
||||
}
|
||||
}
|
||||
|
||||
private static void checkJavaVersion() {
|
||||
String version = System.getProperty("java.version");
|
||||
if (version == null || !version.startsWith("1.8")) {
|
||||
System.err.printf("Error: Unsupported Java version %s; currently only version 1.8 is supported.\n", version);
|
||||
System.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
private void requireCordappsDirExists(File dir) {
|
||||
try {
|
||||
if (!dir.mkdir() && !dir.exists()) { // It is unlikely to enter this if-branch, but just in case.
|
||||
|
Loading…
Reference in New Issue
Block a user