How to messaging with roo.bat

I have some problems with execute .bat file.
I used Spring Roo to generate web services from the command line and wanted to write a connector to the .bat file from java code.
When I launch my application, it hangs tight, (it seems the current thread is switching to a .bat file).
How can I configure support for the command exchange process between roo.bat(or another .bat file) and java code.

For example:
--> start roo.bat
--> answer: roo> 
--> send from java: project setup --topLevelPackage org.springframework.roo.example
ProcessBuilder pb = new ProcessBuilder("cmd", "/c", "C://Users/Documents/roo/bin/roo.bat");
pb.redirectErrorStream(true);
Process proc = pb.start();
InputStream is = proc.getInputStream();
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr);

String line;
int exit = -1;

while ((line = br.readLine()) != null) {
    // Outputs your process execution
    System.out.println(line);
    try {
        exit = proc.exitValue();
        if (exit == 0)  {
            // Process finished
        }
    } catch (IllegalThreadStateException t) {
            proc.destroy();
    }
}

Leave a Reply

avatar
  Subscribe  
Notify of