diff --git a/node/src/main/kotlin/net/corda/node/Main.kt b/node/src/main/kotlin/net/corda/node/Main.kt index 1d66216ac1..f5a8fe15dc 100644 --- a/node/src/main/kotlin/net/corda/node/Main.kt +++ b/node/src/main/kotlin/net/corda/node/Main.kt @@ -34,6 +34,8 @@ fun printBasicNodeInfo(description: String, info: String? = null) { } fun main(args: Array) { + checkJavaVersion() + val startTime = System.currentTimeMillis() val parser = OptionParser() @@ -115,9 +117,24 @@ fun main(args: Array) { exitProcess(0) } +private fun checkJavaVersion() { + // Check we're not running a version of Java with a known bug: https://github.com/corda/corda/issues/83 + try { + Paths.get("").normalize() + } catch (e: ArrayIndexOutOfBoundsException) { + println(""" + You are using a version of Java that is not supported (${System.getProperty("java.version")}). Please upgrade to the latest version. + Corda will now exit...""") + exitProcess(1) + } +} + private fun printPluginsAndServices(node: Node) { node.configuration.extraAdvertisedServiceIds.let { if (it.isNotEmpty()) printBasicNodeInfo("Providing network services", it) } - val plugins = node.pluginRegistries.map { it.javaClass.name }.filterNot { it.startsWith("net.corda.node.") || it.startsWith("net.corda.core.") }.map { it.substringBefore('$') } + val plugins = node.pluginRegistries + .map { it.javaClass.name } + .filterNot { it.startsWith("net.corda.node.") || it.startsWith("net.corda.core.") } + .map { it.substringBefore('$') } if (plugins.isNotEmpty()) printBasicNodeInfo("Loaded plugins", plugins.joinToString()) }