RuntimeException determining Java version on OpenJDK (in Netbeans IDE)

Caused by: ‘java.lang.RuntimeException: Could not determine Java version.’ Full stacktrace:

Found Gradle changeset 26647ee introduced parsing the ‘-version’ output from an exec() call to Java. ‘’ expects that “java version” immediately precedes the version number.

However, OpenJDK on Linux (at least, Fedora 20) outputs ‘openjdk’ instead of ‘java’: ‘’’ $ java -version openjdk version “1.8.0_11” OpenJDK Runtime Environment (build 1.8.0_11-b12) OpenJDK 64-Bit Server VM (build 25.11-b02, mixed mode) ‘’’

I reported this to the Netbeans plugin author, as perhaps the plugin is doing something different than Gradle expects. I seem to be able to use Gradle from the command line without issue, however the Gradle parsing logic is making too strict of an assumption in either case.

The IDE’s environment is: ‘’’ Product Version: NetBeans IDE 8.0 (Build 201403101706) Updates: NetBeans IDE is updated to version NetBeans 8.0 Patch 2 Java: 1.8.0_11; OpenJDK 64-Bit Server VM 25.11-b02 Runtime: OpenJDK Runtime Environment 1.8.0_11-b12 System: Linux version 3.15.7-200.fc20.x86_64 running on amd64; UTF-8; en_US (nb)

Gradle Support plugin Version: 1.3.1 Source: Plugin Portal ‘’’

Parsing versions is probably dangerous.

Probably a dupe of GRADLE-3156 – if so, sorry for the noise.

Yes, this is duplicate.