AllExperts > Experts 
Search      

Java

Volunteer
Answers to thousands of questions
 Home · More Questions · Answer Library  · Encyclopedia ·
More Java Answers
Question Library

Ask a question about Java
Volunteer
Experts of the Month
Expert Login

Awards

About Us
Tell friends
Link to Us
Disclaimer

 
 
 
 
About Artemus Harper
Expertise
I have a BS in computer science and am working towards a Masters degree.

Experience
I have experience in Core Java, good background in Java swing/gui, some experience with JNI, Java reflection, and Java java.nio.* knowledge of Java bytecode and annotations. Basics in c++ and c#
 
   

You are here:  Experts > Computing/Technology > Focus on Java > Java > 64bit Windows2003 filtering the entries of regedit when invoking by Runtime.exec()

Topic: Java



Expert: Artemus Harper
Date: 6/11/2008
Subject: 64bit Windows2003 filtering the entries of regedit when invoking by Runtime.exec()

Question
Hi Experts,

I am creating a process and with that process am invoking a batch file.

Content of Java program:

Runtime runTime = Runtime.getRuntime();   
process = runTime.exec("cmd /c C:Demoversion.bat");
(OR)
process = runTime.exec("C:Demoversion.bat");


Content of bat file:
start /w regedit /e reg1.txt

When am invoking this bat file at command prompt am getting all the entries. Where as if am invoking the same bat file thru a java program many entries got filter.

Can some one help me how to get all entries of regedit with a java process.


My operating system is 64 bit windows 2003 and the java version is 1.5.0_10.

Thanks in advance.

Answer
The output of the batch file (and by extension regedit) is not automatically redirected to standard out.

To redirect the output to standard out you could:

InputStream processOut = process.getInputStream();
int nextByte;
while((nextByte = processOut.read()) != -1)
{
  System.out.write(nextByte);
}

Add to this Answer    Ask a Question



  Rate this Answer
   Was this answer helpful?
Not at allDefinitely              
   12345  

     
About Us | Advertise on This Site | User Agreement | Privacy Policy | Help
Copyright  © 2008 About, Inc. About and About.com are registered trademarks of About, Inc. The About logo is a trademark of About, Inc. All rights reserved.