Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Suppressing error msgs from cmd-line.

Reply
Thread Tools

Suppressing error msgs from cmd-line.

 
 
Lax
Guest
Posts: n/a
 
      02-27-2004
Hello all,
From my Java program, I'm constructing a cmd-line one-liner and
running it from the shell on various platforms.

Is there any platform independent way to suppress error messages from
the cmd-line?
e.g., if the program does a "ls somefile.txt" on Unix and an analogous
"dir somefile.txt" on WIN, I want to suppress the error msgs, if
somefile.txt is not present.

In Unix, I could do a "ls somefile.txt 2> /dev/null".
But, is there a platform independent way to do the suppression.

Alternatively, how does one suppress the error msgs from WIN cmd?

Thanks for your time,
Prab
 
Reply With Quote
 
 
 
 
Johan Poppe
Guest
Posts: n/a
 
      02-27-2004
Lax skrev:

>e.g., if the program does a "ls somefile.txt" on Unix and an analogous
>"dir somefile.txt" on WIN, I want to suppress the error msgs, if
>somefile.txt is not present.
>
>In Unix, I could do a "ls somefile.txt 2> /dev/null".
>But, is there a platform independent way to do the suppression.


Yes: Write a Java program

>Alternatively, how does one suppress the error msgs from WIN cmd?


dir somefile.txt 2> nul

(I'm not quite sure if error redirection works on win95)

--
Riktig sitering gjør meldingene dine lettere å lese:
< url: http://home.online.no/~vidaandr/news/OBSquoting.html >
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Status of sftp/ssh connection. Retrieve error-msgs Walle Wallen Ruby 0 05-25-2010 07:54 PM
Capturing error msgs from output = `cmd` Victor Reyes Ruby 7 12-27-2007 03:57 PM
No syntax error msgs in the Browser Robin ASP General 6 03-22-2006 04:44 PM
Struts validation- placing error msgs spb Java 2 12-12-2005 10:57 PM
500 error msgs from a .css file? dschelberg@volt.com ASP General 2 11-06-2003 04:34 PM



Advertisments