This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes JBoss/WildFly and the fly likes To run and restart the jboss server through java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "To run and restart the jboss server through java" Watch "To run and restart the jboss server through java" New topic
Author

To run and restart the jboss server through java

umesh bengaluru
Greenhorn

Joined: Jan 29, 2007
Posts: 10
Dear all,

i am trying to run and restart the jboss server through the java programm where server present in C:\jboss\bin. Please can any one help how to make this . my code to run the run.bat file goes below

String cmd = "C:\\jboss\\bin\run.bat";
try{
Runtime runtime = Runtime.getRuntime();
Process porc = runtime.exec(cmd);
}

but i need to restart aslo.......their is no sucessful result...

thanks in advance.
[ March 27, 2007: Message edited by: umesh bs ]
Nicole Lacoste
Ranch Hand

Joined: Oct 04, 2006
Posts: 30
Hi

I am doing the same sort of thing with Tomcat. To start Tomcat I first check if Tomcat is running by trying to open a socket to it
this throws an UnknownHostException if Tomcat is not running. If Tomcat is running, I stop it, then I start Tomcat and wait till it is running before returning. It takes a few seconds for Tomcat to start running and I don't want the rest of my application to interact with Tomcat until its really running. To stop Tomcat I call the shutdown.bat then wait till there is no Tomcat running before returning. What does restart mean to you? That you shutdown then start again?

I am not sure how similar JBoss is, does it have a shutdown.bat too? I am pretty sure the socket thing would be the same (or what ever address you configured JBoss too).

Good luck

Niki
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: To run and restart the jboss server through java
 
Similar Threads
The console/command window disappears (jboss via run.bat)
Starting JBoss
How to restart the jboss server through java
Not able to Start JBoss(run.bat)
Issues Re Environment and Path Variables In Windows XP For JBoss and ANT