Preciso executar o wget através do meu programa, estou usando Runtime.getRuntime().exec(“c:\wget\wget.exe”). Até ai blz, o problema é que eu quero que o wget execute sem que o usuário veja, ou seja, passar os comandos junto com a chamada do programa. Tenho um exemplo em delphi e quero saber como faço isso em java.
WinExec('c:\wget\wget.exe -O C:\wget\teste.txt -a C:\wget\log_conexao.txt http://localhost/programas/bgaux/LeituraDirTXT_a.php', SW_SHOW);
String opcoes = "-O C:\wget\teste.txt -a C:\wget\log_conexao.txt http://localhost/programas/bgaux/LeituraDirTXT_a.php"
ou
String opcoes = "cmd -O C:\wget\teste.txt -a C:\wget\log_conexao.txt http://localhost/programas/bgaux/LeituraDirTXT_a.php"
ou de outra forma?
Dei uma olhada na api e vi existem várias opções do comando exec, qual delas se encaixa melhor para resolver o meu problema?
exec(String command) -> Executes the specified string command in a separate process.
exec(String[] cmdarray) -> Executes the specified command and arguments in a separate process.
exec(String[] cmdarray, String[] envp) -> Executes the specified command and arguments in a separate process with the specified environment.
exec(String[] cmdarray, String[] envp, File dir) -> Executes the specified command and arguments in a separate process with the specified environment and working directory.
exec(String command, String[] envp) -> Executes the specified string command in a separate process with the specified environment.
exec(String command, String[] envp, File dir) -> Executes the specified string command in a separate process with the specified environment and working directory.