public static void startProcess(long targetPid, List<String> attachArgs) {
        // find java/java.exe, then try to find tools.jar
        String javaHome = findJavaHome();

        // find java/java.exe
        File javaPath = findJava();
        if (javaPath == null) {
            throw new IllegalArgumentException(
                    "Can not find java/java.exe executable file under java home: " + javaHome);
        }

        File toolsJar = findToolsJar();

        if (JavaVersionUtils.isLessThanJava9()) {
            if (toolsJar == null || !toolsJar.exists()) {
                throw new IllegalArgumentException("Can not find tools.jar under java home: " + javaHome);
            }
        }

        List<String> command = new ArrayList<String>();
        command.add(javaPath.getAbsolutePath());

        if (toolsJar != null && toolsJar.exists()) {
            // solve tools.jar com.sun.tools.attach.VirtualMachine Class not found exception
            command.add("-Xbootclasspath/a:" + toolsJar.getAbsolutePath());
        }

        command.addAll(attachArgs);

        if (!JavaVersionUtils.isLessThanJava9())
            command.add("greater_than_jdk9_flag");
        if (toolsJar != null && toolsJar.exists())
            command.add("bootstart_flag");

        ProcessBuilder pb = new ProcessBuilder(command);

        try {
            final Process proc = pb.start();
            Thread redirectStdout = new Thread(new Runnable() {
                @Override
                public void run() {
                    InputStream inputStream = proc.getInputStream();
                    try {
                        IOUtils.copy(inputStream, System.out);
                    } catch (IOException e) {
                        IOUtils.close(inputStream);
                    }

                }
            });

            Thread redirectStderr = new Thread(new Runnable() {
                @Override
                public void run() {
                    InputStream inputStream = proc.getErrorStream();
                    try {
                        IOUtils.copy(inputStream, System.err);
                    } catch (IOException e) {
                        IOUtils.close(inputStream);
                    }

                }
            });
            redirectStdout.start();
            redirectStderr.start();
            redirectStdout.join();
            redirectStderr.join();

            int exitValue = proc.exitValue();
            if (exitValue != 0) {
                AnsiLog.error("attach fail, targetPid: " + targetPid);
                System.exit(1);
            }
        } catch (Throwable e) {
            // ignore
        }
    }
<pre>
1. Try to find java home from System Property java.home
2. If jdk > 8, FOUND_JAVA_HOME set to java.home
3. If jdk <= 8, try to find tools.jar under java.home
4. If tools.jar do not exists under java.home, try to find System env JAVA_HOME
5. If jdk <= 8 and tools.jar do not exists under JAVA_HOME, throw IllegalArgumentException
</pre>

@return
cop/src/main/java/code/landgrey/copagent/utils/ProcessUtils.java