public static String findJavaHomeFromJavaExecutable(String javaExecutable) {
        String[] cmd = {javaExecutable, "-XshowSettings:properties", "-version"};
        final List<String> output = new ArrayList<>();
        exec(cmd, output);
        return output.stream()
                .filter(l -> l.contains(" java.home = "))
                .map(l -> l.substring(l.indexOf('=') + 1).trim())
                .findFirst()
                .orElse(null);
    }
@Test
    void findJavaHomeFromPath() {
        final String expectedJavaHome = System.getProperty("java.home");
        Assertions.assertEquals(
                expectedJavaHome, OsUtils.findJavaHomeFromJavaExecutable(expectedJavaHome + "/bin/java"));
    }