Java Processbuilder Calls the command error: CreateProcess error = 2

ArrayList<String> convert = new ArrayList<String>();
convert.add("ffmpeg -y -i C:/Users/fang/Desktop/1.m4a -ar 8000 -acodec mp3 C:/Users/fang/Desktop/5.mp3"); 
ProcessBuilder builder = new ProcessBuilder();
        try {
            builder.command(convert);
            // If this property is true, any error output generated by subsequent child processes started by the start() method of this object will be merged with the standard output.
            // so both can be read using the Process.getInputStream() method. This makes it easier to associate error messages with the corresponding output
            builder.redirectErrorStream(true);
            Process process = builder.start();

            InputStream is = process.getInputStream();
            InputStreamReader inst = new InputStreamReader(is, "GBK");
            BufferedReader br = new BufferedReader(inst);//Input stream buffer
            String res = null;
            StringBuilder sb = new StringBuilder();
            while ((res = br.readLine()) ! = null) {//Loop through the data in the buffer
                sb.append(res + "\n");
            }
            System.out.println(sb.toString());
        } catch (Exception e) {
            mark = false;
            System.out.println(e);
            e.printStackTrace();
        } finally {

        }

Solution:

The commands in processbuilder must be specified by full path, otherwise an error will be reported.

D:\\softwares\\ffmpeg-4.4.1-essentials_build\\bin\\ffmpeg.exe -y -i C:/Users/fang/Desktop/1.m4a -ar 8000 -acodec mp3 C:/Users/fang/Desktop/5.mp3

Read More: