The Artima Developer Community
Sponsored Link

Java Answers Forum
System testing

3 replies on 1 page. Most recent reply: May 18, 2003 10:49 PM by Mohan

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 3 replies on 1 page
Ghufran Vanjara

Posts: 2
Nickname: ghufran
Registered: May, 2003

System testing Posted: May 15, 2003 7:59 PM
Reply to this message Reply
Advertisement
I am running system test cases for my application. I am using a batch script to do that. I am trying to redirect output from the console to a file using a batch script.I use the > symbol. The prob is that I am running a java command, and the first thing it does is it outputs a welcome message, and then an error message after some processing. I want to capture that error message to the file,but it is only capturing the welcome message. If anybody can help it would be great.


Rahul

Posts: 52
Nickname: wildhorse
Registered: Oct, 2002

Re: System testing Posted: May 16, 2003 6:11 AM
Reply to this message Reply
' 1> ' is used to direct standard ouput stream and ' 2> ' for standard error stream.

either you could use two commands in your script like:

java filename 1>> filename.txt
java filename 2>> filename.txt

'>>' appends the program output to the contents of the file.

or, there are some dos utilities available which redirect the standard error stream. try anyone of those.

Mohan

Posts: 3
Nickname: deerhunter
Registered: May, 2003

Re: System testing Posted: May 18, 2003 10:36 PM
Reply to this message Reply
u cud redirect the std out or std err to a file/ file(s) from java itself.

PrintStream my_std_err = new PrintStream (new FileOutputStream ("/my_home/my_err_file", true));
// open with append true

System.setOut(my_std_err);
System.err.println(" test error message");
similarly with Sys.out too.

Mohan

Posts: 3
Nickname: deerhunter
Registered: May, 2003

Re: System testing : Correxn Posted: May 18, 2003 10:49 PM
Reply to this message Reply
Err..
Read System.setErr(my_std_err);
;-)

Flat View: This topic has 3 replies on 1 page
Topic: JAKARTA  STRUTS !!!!!!!!!!!!!!!!!! Previous Topic   Next Topic Topic: triangular numbers tester

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use