🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Runtime.exec()

#408
From: Christoph Sperle
Date: Tue, 02 Nov 1999 00:00
34 lines
1382 bytes
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.
Technical Details
Message-ID: <7vmjmm$s23$1@n.ruf.uni-freiburg.de>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f74b3,4d3120dc2eea2114,start
X-Google-Attributes: gidf74b3,public
X-Google-Thread: 10a146,4d3120dc2eea2114,start
X-Google-Attributes: gid10a146,public
From: "Christoph Sperle" <sperle@wi.ba-loerrach.de>
Subject: Runtime.exec()
Date: 1999/11/02
Message-ID: <7vmjmm$s23$1@n.ruf.uni-freiburg.de>
X-Deja-AN: 543504806
X-Priority: 3
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2014.211
Organization: Rechenzentrum der Universitaet Freiburg, Germany
X-MSMail-Priority: Normal
Newsgroups: comp.lang.java.programmer,borland.public.jbuilder.java.language