You Are Here:

Community: Developer Discussion Boards

#1 Old Getting the contents of the system error stream - 2004-05-27, 11:19

Join Date: May 2004
Posts: 2
neilf79
Offline
Registered User
Does anybody know if there is any way I can look at the contents of System.err on a Nokia phone (or indeed System.out, since, looking at the implmenentation they are the same)? I'm getting a NullPointerException that I can't reproduce on the emulator and would very much like its stack trace.

Thanks.

Neil.

P.S. Does anyone else find the absence of a Throwable.printStackTrace(PrintStream) method VERY annoying?! It's not like it saves any space by not having it...
Reply With Quote

#2 Old 2004-05-28, 21:18

Join Date: Aug 2003
Posts: 232
Location: uk
Send a message via ICQ to alex_crowther
alex_crowther's Avatar
alex_crowther
Offline
Regular Contributor
for emulators you can:

emulator <options> | cat

This will make the emulator output visible in the console.

Unless you are using djgpp or cygwin you probably won't have cat.exe so find a copy on the internet, or just compile the following C cat program

Code:
#include <stdio.h>

/* compile with: gcc cat.c -s -O2 -o cat.exe */

int main(int argc, char **argv)
{
	FILE *stream;
	int c;

	if (argc == 1)
		stream = stdin;
	else
		stream = fopen(argv[1], "r");

	if (!stream)
		return(-1);

	while( (c=fgetc(stream)) != -1)
		fputc(c, stdout);

	if (argc > 1)
		fclose(stream);

	return(0);
}
If you want to redirect stdout/stderr on a phone, your
out of luck, I don't think it can be done.

Alex
Reply With Quote

#3 Old 2005-06-08, 14:03

Join Date: Jun 2004
Posts: 4
markdb
Offline
Registered User
" Does anyone else find the absence of a Throwable.printStackTrace(PrintStream) method VERY annoying?! "

Truly unbelievable, along with the lack of ways of trapping an OutputStream's output after it's been created,
and the fact that System.err and System.out are final.

I'm tempted to write a test app. to see if all manufacturer's KVMs *do* make .err and .out final...
Reply With Quote
Reply « Previous Thread | Next Thread »
Display Modes
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules

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

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Forum Jump

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia