Donate. I desperately need donations to survive due to my health

Get paid by answering surveys Click here

Click here to donate

Remote/Work from Home jobs

Java access cmd

How would this code access all the program on the desktop?

    import java.io.File;
import java.io.IOException;
import java.util.Scanner;

public class cmd {

    public static void main(String[] args) throws IOException {

        String[] command = {"ls", "-al"};
        String str;
        Scanner scan= new Scanner(System.in);
        str=scan.nextLine();
        ProcessBuilder builder = new ProcessBuilder(command);
        builder = builder.command(str);
        Process p = builder.start();



    }

}

Comments