Non si legge moltocodice:exec public Process exec(String cmd, String[] envp) throws IOException Executes the specified string command in a separate process with the specified environment. This method breaks the command string into tokens and creates a new array cmdarray containing the tokens in the order that they were produced by the string tokenizer; it then performs the call exec(cmdarray, envp). The token parsing is done by a StringTokenizer created by the call: new StringTokenizer(command) with no further modification of the character categories. The environment variable settings are specified by envp. If envp is null, the subprocess inherits the environment settings of the current process. Parameters: cmd - a specified system command.envp - array of strings, each element of which has environment variable settings in format name=value. Returns: a Process object for managing the subprocess. Throws: SecurityException - if a security manager exists and its checkExec method doesn't allow creation of a subprocess. IOException - if an I/O error occurs NullPointerException - if cmd is null IllegalArgumentException - if cmd is emptySee Also: exec(java.lang.String[]), exec(java.lang.String[], java.lang.String[]), SecurityManager.checkExec(java.lang.String![]()
Una letturina alle api non farebbe male
Avrebbe potuto pure scrivere
non sarebbe cambiato nullacodice:if (est.equals("txt")) { Process process = Runtime.getRuntime.exec("notepad", new String[]{file}); }
Perchè quel metodo accetta come parametro un array di String
Ciauz
![]()





Rispondi quotando