| Author |
Can I call jboss run.bat from a java application?
|
David Chen
Ranch Hand
Joined: Jan 06, 2002
Posts: 57
|
|
Hi, there: I have a question about jboss start. Can I call run.bat from a stand alone java application? by using: I did try several times, but no any luck, it totally hangs my application (of couse the jboss did not get started at all). I tried consume inputstream, and errorStream in separate threads, still not helps. So, If I'm not supposed to start jboss server from java application, then why? or is there any other work around to start jboss dynamically from application? how? Thanks a lot in advance David
|
 |
Gurumurthy Ramamurthy
Ranch Hand
Joined: Feb 13, 2003
Posts: 272
|
|
Use this: import java.util.*; import java.io.*; public class JBossStart { public static void main (String arg[]) { try { Runtime rt = Runtime.getRuntime (); // step 1 Process process = rt.execexec("cmd.exe C:/ C:/jboss-2.4.8/bin/run.bat"); // step 2 InputStreamReader reader = // step 3 new InputStreamReader ( process.getInputStream () ); BufferedReader buf_reader = new BufferedReader ( reader ); // step 4. String line; System.out.println("Guru: JBoss started..."); while ((line = buf_reader.readLine ()) != null) System.out.println (line); } catch (IOException e) { System.out.println (e); } } // main } // class RunTimeApp
|
 |
David Chen
Ranch Hand
Joined: Jan 06, 2002
Posts: 57
|
|
Hi, Gurumurthy: Thank you very much for your reply. However, as I said in my previous post, I did consume both inputstream and stderr stream. And some gurus from jboss, java forum found my problem. Actually jboss "run.bat" can not be called outside jboss/bin directory. So, just put my application class under bin directory and execute "run.bat", it works. Thanks a lot again David
|
 |
 |
|
|
subject: Can I call jboss run.bat from a java application?
|
|
|