commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nie fei <>
Subject Why execute a ping unavailable address will raise exception?
Date Wed, 07 Nov 2012 07:22:13 GMT
I'm a new learner for this API. Sorry for the last mail, my mistake with
wrong button.

CommandLine cmdLine = CommandLine.parse("ping -n 1");

        ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
        DefaultExecutor exec = new DefaultExecutor();
        PumpStreamHandler streamHandler = new PumpStreamHandler(

Normally, if the address is available, then there will be no exception
raised. Otherwise, the exec.execute(cmdLine) will raise exception:

Process exited with an error: 1 (Exit value: 1)

Is it normal? Can anyone explain why?

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message