Skip to content

Commit

Permalink
CORDA-1633 - Check Java version before launch (corda#4128)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tommy Lillehagen authored Oct 29, 2018
1 parent ff9061b commit 199a203
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions node/src/main/java/CordaCaplet.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ private String getOption(List<String> args, String option) {

@Override
protected ProcessBuilder prelaunch(List<String> jvmArgs, List<String> args) {
checkJavaVersion();
nodeConfig = parseConfigFile(args);
return super.prelaunch(jvmArgs, args);
}
Expand Down Expand Up @@ -143,6 +144,14 @@ private void augmentClasspath(List<Path> classpath, File dir) {
}
}

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.
Expand Down

0 comments on commit 199a203

Please sign in to comment.