aspose file tools
The moose likes JBoss and the fly likes Can I call jboss run.bat from a java application? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Products » JBoss
Reply Bookmark "Can I call jboss run.bat from a java application?" Watch "Can I call jboss run.bat from a java application?" New topic
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: 271
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?
 
Threads others viewed
Running JBoss Project in Debug Mode
Cant Start JBOSS by Run.bat
How to start and stop jboss 3. 4.2
Setting up JBoss, IntelliJ, and Java EE
Error While Starting JBoss 5.1.0 GA!!!
MyEclipse, The Clear Choice

cast iron skillet 49er

more from paul wheaton's glorious empire of web junk: cast iron skillet diatomaceous earth rocket mass heater sepp holzer raised garden beds raising chickens lawn care CFL flea control missoula heat permaculture