Chetan Sanghi

Greenhorn
+ Follow
since Jul 30, 2003
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Chetan Sanghi

Hi All

I am using Runtime.exec() to execute some commands, capture the output of the command and process it. In my case the output is in XML format and output can be very large i.e. upto 11-15 MB for a command.

First I created a command string which contained full path to command I want to execute, command name, arguments and redirect file name. For eg
<command_path>/<command_name> <list_of_arguments> >> <redirect_file_name>

Using Runtime.exec(String) version it did not work as parser have problem giving redirect symbol as parser assumes its also an argument for command.

Then I tried another approach where I just execute the command and get the large XML output and write it myself to a file in chunks of 8K buffer. I get the Process.getInputStream() and use BufferedWriter to write it out myself.



This works but after a while I get out of memory error for my application.

I was wondering if somebody who has experience handling large output from commands using Runtime.exec on Unix and Windows can advice or help me.

My email id is xxx@xxx

Thanks in advance.

[please use the forum, not email - thanks, Ilja]
[ August 17, 2005: Message edited by: Ilja Preuss ]
19 years ago
Passed. I am in Longmont Colorado.

Thanks a much to Richard for his great book.
Can you tell us about the format/pattern of the exam?

Thanks in advance.

--Chetan
Hi

How can I try it repeatdly?

--Chetan
Hi

How can I try it repeatdly?

--Chetan
Hi All

What will be the pattern of the exam? Multiple choice question, description questions or what? Does anybody have an idea?

--Chetan
Hi
I passed the SCJP 1.4 with 96%. Now I am planning to prepare for SCWCD and beta exam for Web Services. For SCJP I used :
1. A Programmer's Guide to Java Certification: Khalid Mughal, Rolf Rasmussen
2.Sun Certified Programmer & Developer for Java 2 Study Guide (Exam 310-035 & 310-027)
3. Whizlabs Simulator for SCJP.
All were of great help and I learned a lot besides passing the exam.
Bye for now.
Chetan
20 years ago