🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.java.programmer
Article #407

Re: Runtime.exec()

#407
From: Prantor Bora
Date: Tue, 07 Dec 1999 00:00
55 lines
2222 bytes
Runtime.exec() will work only with pure windows executable(notepad.exe
etc.), not simmulated DOS commands(COPY).


geoff_robinson@my-deja.com wrote:

> Try breaking this apart so you can do a little debugging.
>
> Process p = r.exec(command);
> p.waitFor();
>
> see if it works, then do the Input Stream stuff.
>
> Geoff
>
> In article <7vmjmm$s23$1@n.ruf.uni-freiburg.de>,
>   "Christoph Sperle" <sperle@wi.ba-loerrach.de> wrote:
> > Hi,
> >
> > I have a Problem with the exec-Method of the Runtime-Object. On the
> > DOS-Commandline this statement works propperly:
> >
> > command.com /c copy C:\print.ps lpt1
> >
> > but with the exec-Method it doesen't. Here is my Programm:
> >
> > import java.io.*;
> >
> > public class doscommand {
> >
> >     public static void main (String[]args){
> >
> >         int i;
> >         InputStream is;
> >
> >         try{
> >             is = Runtime.getRuntime().exec("command.com /c copy
> C:\\print.ps
> > lpt1").getInputStream();
> >             while((i = is.read()) != -1) System.out.print((char)i);
> >         }
> >         catch(java.io.IOException e) {
> >             System.err.println(e.getMessage());
> >             System.exit(1);
> >     }
> > }
> >
> > Why is this? Can anyone help me?
> >
> > Thank you, christoph.
> >
> >
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
Technical Details
Message-ID: <384D2C4D.8BFB7378@lawson.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <7vmjmm$s23$1@n.ruf.uni-freiburg.de> <7vn3ej$4ku$1@nnrp1.deja.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f74b3,4d3120dc2eea2114
X-Google-Attributes: gidf74b3,public
X-Google-Thread: 10a146,4d3120dc2eea2114
X-Google-Attributes: gid10a146,public
From: Prantor Bora <prantor.bora@lawson.com>
Subject: Re: Runtime.exec()
Date: 1999/12/07
Message-ID: <384D2C4D.8BFB7378@lawson.com>
X-Deja-AN: 557946326
Content-Transfer-Encoding: 7bit
References: <7vmjmm$s23$1@n.ruf.uni-freiburg.de> <7vn3ej$4ku$1@nnrp1.deja.com>
X-Accept-Language: en
Content-Type: text/plain; charset=us-ascii
X-Complaints-To: abuse@onvoy.com
X-Trace: news7.onvoy.net 944603560 206.145.14.2 (Tue, 07 Dec 1999 15:52:40 CST)
Organization: Onvoy
MIME-Version: 1.0
NNTP-Posting-Date: Tue, 07 Dec 1999 15:52:40 CST
Newsgroups: comp.lang.java.programmer,borland.public.jbuilder.java.language