7

Is it possible to programmatically start and stop JBoss in Eclipse? I am using Indigo Eclipse Java EE, I have a JBoss 5.1.0.GA server that I manually start/stop in Eclipse.

I want to automate restarting the server (as part of a test procedure to restart the server to reflect changes in the database). Is there some library that I can use to do this, or some other way of accomplishing this?

Tom
  • 221
  • 4
  • 15
  • Well, you could write a separate program module that is referring to the jboss .bat files.. Just a thought. – user Feb 22 '13 at 15:09

1 Answers1

5

Create a .bat or .sh file (depending on the OS your JBoss instance is installed) with a script that executes the shutdown (bat or sh) and then the run (bat or sh). There's no need to use Java or any other programming language for this.

Still, if you really want to do this using Java, you can use one of the approaches (again, depending on the OS):

Batch files:

Shell files:

Just note that the run and stop scripts files are in [JBoss_install_path]/bin

Community
  • 1
  • 1
Luiggi Mendoza
  • 85,076
  • 16
  • 154
  • 332
  • Does it matter that I started it in Eclipse? Eclipse won't recognize that it is started if I manually run run.bat, will it? Also, I'd probably have to mimic the arguments and directly run run.jar, since that's how I think it's started when done in Eclipse. – Tom Feb 22 '13 at 15:22
  • 1
    Nope, it won't matter if you started your JBoss instance from Eclipse or manually, the stop.jar will, uhm, stop the JBoss running instance. Note that doing this, Eclipse may be not synchronized with the JBoss running instance. – Luiggi Mendoza Feb 22 '13 at 15:24