Skip to content

Instantly share code, notes, and snippets.

@Rogach
Last active February 2, 2023 15:18
Show Gist options
  • Save Rogach/6f9639e3025ba744fb77b895c841acf4 to your computer and use it in GitHub Desktop.
Save Rogach/6f9639e3025ba744fb77b895c841acf4 to your computer and use it in GitHub Desktop.
searching for java8-openjfx build issue
ext.javaBinary = "/usr/lib/jvm/java-8-openjdk/bin/java"
def inStream = new java.io.BufferedReader(new java.io.InputStreamReader(new java.lang.ProcessBuilder(ext.javaBinary, "-version").start().getErrorStream()));
try {
String line = inStream.readLine();
while (line != null) {
if (line.contains("Runtime Environment (build ")) {
int ib = line.indexOf(" (build ");
if (ib != -1) {
String ver = line.substring(ib + 8, line.size() - 1);
project.ext.set("jdkRuntimeVersion", ver);
}
}
line = inStream.readLine();
}
} finally {
inStream.close();
}
if (!project.hasProperty("jdkRuntimeVersion")) throw new Exception("Unable to determine the version of Java in JDK_HOME");
System.out.println(ext.jdkRuntimeVersion)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment