code: private static boolean isModular(final Path javaHome) {
          boolean result;
          final List<String> cmd = new ArrayList<>();
          cmd.add(resolveJavaCommand(javaHome));
          cmd.add("--add-modules=java.se");
          cmd.add("-version");
          final ProcessBuilder builder = new ProcessBuilder(cmd);
          Process process = null;
          Path stdout = null;
          try {
              // Create a temporary file for stdout
              stdout = Files.createTempFile("stdout", ".txt");
              process = builder.redirectErrorStream(true)
                      .redirectOutput(stdout.toFile()).start();
  
              if (process.waitFor(1, TimeUnit.SECONDS)) {
                  result = process.exitValue() == 0;
              } else {
                  result = false;
              }
          } catch (IOException | InterruptedException e) {
              result = false;
          } finally {
              if (process != null && process.isAlive()) {
                  process.destroyForcibly();
              }
              if (stdout != null) {
                  try {
                      Files.deleteIfExists(stdout);
                  } catch (IOException ignore) {
                  }
              }
          }
          return result;
      }
docs: Checks to see if the {@code javaHome} is a modular JVM.
  
  @param javaHome the Java Home if {@code null} an attempt to discover the Java Home will be done
  
  @return {@code true} if this is a modular environment