Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / April 2006

Tip: Looking for answers? Try searching our database.

Help with Java Runtime class - on Windows

Thread view: 
Ivar - 14 Apr 2006 14:00 GMT
Hi,
So when I try to run a batch file that contains the path of an
executable (specific to my project), then it runs properly, spewing out
relevant data as desired. But when I try to run the same batch file
through Java's Runtime class, then the program hangs on me. Here's the
relevant code for the program..please let me know where I'm wrong..

import java.io.BufferedReader;
import java.io.InputStreamReader;

public class processTest {

    /**
    * @param args
    */
    public static void main(String[] args) {
        // TODO Auto-generated method stub
        try {
        String args2[] = {"cmd","/c","Test3.bat"};
        BufferedReader reader = new BufferedReader(new
InputStreamReader(ps.getInputStream()));
        String line = null;
        while((line = reader.readLine()) != null) {
            System.out.println(line);
        }
        } catch(Exception ioe) {ioe.printStackTrace();}
    }

}
As stated above...Test3.bat works fine..but this above program hangs on
me....
Thanks,
RS
Jean-Francois Briere - 14 Apr 2006 22:53 GMT
This above program doesn't even compile.
Please show the real code you're executing.
Question: Do you execute the processTest class in the same folder as
the one where Test3.bat is located? Should work that way.

Regards
Ivar - 23 Apr 2006 17:14 GMT
yes i do that...

Thanks,
Ravi Sathyam


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.