PDA

View Full Version : [java] e Runtime.exec() aiuto....


peppedx
19-07-2003, 15:11
Ho provato a lanciare un eseguibile che necessitava di parametri, ma ho scoperto che Runtime.exec(cmd) esegue una tokenizzazzione (brrr che termine brutto...) di cmd per ciņ addio parametri, secondo voi come posso fare a passare i parametri al mio programma? :mc: :muro:

monkey72
19-07-2003, 23:18
da quest'estratto delle Api Java2:

Process exec(String command)
Executes the specified string command in a separate process.
Process exec(String[] cmdarray)
Executes the specified command and arguments in a separate process.
Process exec(String[] cmdarray, String[] envp)
Executes the specified command and arguments in a separate process with the specified environment.
Process exec(String[] cmdarray, String[] envp, File dir)
Executes the specified command and arguments in a separate process with the specified environment and working directory.
Process exec(String cmd, String[] envp)
Executes the specified string command in a separate process with the specified environment.
Process exec(String command, String[] envp, File dir)
Executes the specified string command in a separate
process with the specified environment and working directory

sembrerebbe che tu debba inserire il comando e i parametri in un vettore (secondo metodo)

monkey72
19-07-2003, 23:21
p.s. cmq exec() in windows funziona solo con programmi win32 ma non con comandi DOS

peppedx
21-07-2003, 10:11
Me ne sono tragicamente accorto!!!!!!

monkey72
21-07-2003, 10:44
allora volevi far eseguire un pgm dos?? :) :D

peppedx
21-07-2003, 11:01
Per essere precisi un programma linux ricompilato per dos...