• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

To run and restart the jboss server through java

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic