Programmatically stop and start JBoss in Eclipse

eclipse, java, jboss, jboss5.x

Solution

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:

- How do I run a batch file from my Java Application?

Shell files:

- Java - Execute a .SH file

- Running .sh files with Java's exec in a different directory?

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

Problem

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?

Original source

Related problems