runtime class
From: ambika (indambika_at_yahoo.com)
Date: 02/26/04
- Next message: FISH: "Re: simple search on an XML file"
- Previous message: Tor Iver Wilhelmsen: "Re: how do i create an exe file in java?"
- Next in thread: Mark Haase: "Re: runtime class"
- Reply: Gregory A. Swarthout: "Re: runtime class"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 26 Feb 2004 09:42:33 -0800
hello everyone,
I have a small problem using this runtime class..The code below works
fine without any error...
import java.io.*;
import java.lang.Process;
class trial
{
public static void main(String args[])throws Exception
{
String command[]={"notepad"};
Runtime r=Runtime.getRuntime();
Process p=r.exec(command);
int i;
i=p.waitFor();
}
}
but when i try to run the command "dir" then i get a error like this;
Exception in thread "main" java.io.IOException: CreateProcess: dir
error=0
at java.lang.Win32Process.create(Native Method)
at java.lang.Win32Process.<init>(Unknown Source)
at java.lang.Runtime.execInternal(Native Method)
at java.lang.Runtime.exec(Unknown Source)
at java.lang.Runtime.exec(Unknown Source)
at java.lang.Runtime.exec(Unknown Source)
at trial.main(trial.java:9)
the code which i tried had nothing changed other than the string
command,which i gave as "dir" instead of "notepad"...and the code in
which i got the error is;
import java.io.*;
import java.lang.Process;
class trial
{
public static void main(String args[])throws Exception
{
String command[]={"dir"};
Runtime r=Runtime.getRuntime();
Process p=r.exec(command);
int i;
i=p.waitFor();
}
}
Can someone tell me why does this happen???Thanks to all those who are
going to help me out...
-ambika..
- Next message: FISH: "Re: simple search on an XML file"
- Previous message: Tor Iver Wilhelmsen: "Re: how do i create an exe file in java?"
- Next in thread: Mark Haase: "Re: runtime class"
- Reply: Gregory A. Swarthout: "Re: runtime class"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]