xxxxxxxxxx
/**
* Get the location of the Java by executing a shell command
*/
public String getJavaLocation() {
try {
final Process process = Runtime.getRuntime().exec("/bin/sh -c which java");
return new BufferedReader(new InputStreamReader(process.getInputStream()))
.lines()
.collect(Collectors.joining());
} catch (IOException e) {
//Do something
}
}