Re: Calling foreign executables
From: Herman Timmermans (timmermansdot.hermanat_at_skynet.be)
Date: 12/17/03
- Next message: Anthony Borla: "Re: Calling foreign executables"
- Previous message: Daniel Bonniot: "Re: overriding methods with a different return type"
- In reply to: Hrvoje Somun: "Calling foreign executables"
- Next in thread: Anthony Borla: "Re: Calling foreign executables"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 17 Dec 2003 19:08:44 +0100
Hrvoje Somun wrote:
> How can i call some other program from java application?
>
> let say i want to call iexplorer('iexplore' from command line)...
> thnx
Maybe this could help you as an example, but I would suggest to do some more
eductional reading on java ;-)
import Java.lang.*;
import Java.io.*;
public class RuntimeExecTest {
public static void main(String[] args) {
Runtime rt = Runtime.getRuntime();
String[] callAndArgs = { "Notepad.exe",
"D:\\TEMP\\Test.txt" };
try {
Process child = rt.exec(callAndArgs);
child.waitFor();
System.out.println("Process exit code is:
" + child.exitValue());
}
catch(IOException e) {
System.err.println(
"IOException starting process!");
}
catch(InterruptedException e) {
System.err.println(
"Interrupted waiting for process!");
}
}
}
-- Suse Linux Professional 8.1 on Athlon 1.1 Ghz 512 Mb Anti Spam = remove the "dot" and the "at" Registered Linux User #264690
- Next message: Anthony Borla: "Re: Calling foreign executables"
- Previous message: Daniel Bonniot: "Re: overriding methods with a different return type"
- In reply to: Hrvoje Somun: "Calling foreign executables"
- Next in thread: Anthony Borla: "Re: Calling foreign executables"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]