public static String getProcessOutput(String... command) {
        String out = null;
        try {
            ProcessBuilder pb = new ProcessBuilder(command);
            pb.redirectErrorStream(true);
            Process process = pb.start();
            final BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(process.getInputStream()));
            final StringBuilder response=new StringBuilder();

            new Thread(new Runnable() {
                @Override
                public void run() {
                    try {
                        String line;
                        while ((line = bufferedReader.readLine()) != null) {
                            response.append(line + "\n");
                        }
                    } catch (IOException ex) {
                        //Don't let other process' problems concern us
                    } finally {
                        IOUtils.closeQuietly(bufferedReader);
                    }
                }
            }).start();
            process.waitFor();


            if (response.toString().length() > 0) {
                out = response.toString().trim();
            }
        }
        catch (IOException e) {
            //Some kind of problem running java -version or getting output, just assume the version is bad
            return null;
        } catch (InterruptedException ex) {
            //Something booted us while we were waiting on java -version to complete, just assume
            //this version is bad
            return null;
        }
        return out;
    }