¿Como mandar a llamar programas externos desde java?
Escribi una interfaz en java pero me es necesario utilizar un viejo programa escrito en C que procesa cierta informacion.
Me gustaria saber como llamar comandos o programas externos a java como ls -a, o notepad por ejemplo
Me gustaria saber como llamar comandos o programas externos a java como ls -a, o notepad por ejemplo
Hola. No te iba a responder porque no tengo mucha idea pero en vista de que no te responde nadie investiga si existe system como en C, no sé.
Existe un método "exec(String)", donde String lo debes sustituir por el comando de la aplicacion que quieras lanzar, efectivamente creo que está en la clase System.
Perdón, no es en la clase System, es en java.lang.Runtime, aqui tienes los métodos que puedes usar:
exec(String) - Method in class java.lang.Runtime
Executes the specified string command in a separate process.
exec(String[]) - Method in class java.lang.Runtime
Executes the specified command and arguments in a separate process.
exec(String[], String[]) - Method in class java.lang.Runtime
Executes the specified command and arguments in a separate process with the specified environment.
exec(String[], String[], File) - Method in class java.lang.Runtime
Executes the specified command and arguments in a separate process with the specified environment and working directory.
exec(String, String[]) - Method in class java.lang.Runtime
Executes the specified string command in a separate process with the specified environment.
exec(String, String[], File) - Method in class java.lang.Runtime
Executes the specified string command in a separate process with the specified environment and working directory.
exec(String) - Method in class java.lang.Runtime
Executes the specified string command in a separate process.
exec(String[]) - Method in class java.lang.Runtime
Executes the specified command and arguments in a separate process.
exec(String[], String[]) - Method in class java.lang.Runtime
Executes the specified command and arguments in a separate process with the specified environment.
exec(String[], String[], File) - Method in class java.lang.Runtime
Executes the specified command and arguments in a separate process with the specified environment and working directory.
exec(String, String[]) - Method in class java.lang.Runtime
Executes the specified string command in a separate process with the specified environment.
exec(String, String[], File) - Method in class java.lang.Runtime
Executes the specified string command in a separate process with the specified environment and working directory.