Hi,

What if someone tried a 
Runtime.getRuntime().exec("java"); ?
or Runtime.getRuntime().exec("javac");

I get an IOException for the same.
Wheras, native applications (like "ls" and "clear") work fine.

Whats the differance between the two calls ? 

Regards,
Santosh.

Nathan Meyers wrote:
> 
> On Fri, Sep 29, 2000 at 10:47:49AM -0600, Jason Janelle wrote:
> > Hi fellow coders,
> >    I have been writing java on WindowsNT boxes for a while and am just
> >    trying out java on Linux.  I was trying to issue a command to the
> >    system via this line of code:
> >
> >    Runtime.getRuntime().exec("ls > dir.txt");
> 
> Yes, you need to specify a shell to interpret shell metacharacters like '>'. Try
> this:
> 
>     Runtime.getRuntime().exec(new String[] { "/bin/sh", "-c", "ls > dir.txt" });
> 
> Nathan
> 
> >
> >    It compiles and such but I get no dir.txt.  I tryed a waitFor()
> >    statement but no help.  In windows you have to do "cmd /c dir >
> >    dir.txt" in the exec() and I was wondering if you have to specify a
> >    shell for linux to run in as well.  BTW I'm running Mandrake 7.0.
> >    Any Ideas?
> >
> >
> > --------------
> > Thanks,
> > Jason Janelle
> > mailto: [EMAIL PROTECTED]
> >
> >
> >
> > ----------------------------------------------------------------------
> > To UNSUBSCRIBE, email to [EMAIL PROTECTED]
> > with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
> 
> ----------------------------------------------------------------------
> To UNSUBSCRIBE, email to [EMAIL PROTECTED]
> with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]


----------------------------------------------------------------------
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to