0

how is it possible to start JBoss (Wildfly) application server from a GUI ? I would like to implement a own GUI like XAMPP. Only a "start" - Button and "stop" - Button.

Maybe I have to start the .bat - file? There is a start and stop .bat available, but how can I do this in JAVA? To implement a GUI is not the case. The question is to start / stop the server.

Any ideas?

internet
  • 385
  • 1
  • 8
  • 27

1 Answers1

0

You will have to execute the batch file by passing them to the cmd shell.

If you are developing the script for windows you can have a field that points the JBossAS/Wildfly's Home directory(or can read it from the JBOSS_HOME if its set), and then in the Java Code execute the .bat file in the following way:

Runtime.getRuntime().exec("cmd /c start standalone.bat");

Preferably you can also use the [ProcessBuilder][1] API to create a new process.

Please refer to this post for some helpful pointers

Community
  • 1
  • 1
Shiva
  • 6,677
  • 4
  • 36
  • 61
  • thanks. How is it possible to save the setting that Wildfly start as an Service? So everytime if the PC is up and running the Wildfly server starts automaticly ? – internet Nov 17 '15 at 10:37
  • You can create a wildfly service by running the .bat file present in `bin\service` folder and then query it from the Java code to check if the service is running or not – Shiva Nov 17 '15 at 10:43
  • Please refer to this post http://stackoverflow.com/questions/9075098/start-windows-service-from-java to find out how to query that a service is running or not in java – Shiva Nov 17 '15 at 10:44
  • Hm this is not working, but I got also no error message? String desktopPath = "C:\\Users\\Test\\Desktop\\Software\\wildfly-8.2.0.Final\\bin\\standalone.bat"; String [] cmds = new String [1]; cmds[0] = desktopPath; Process p = Runtime.getRuntime().exec(cmds); p.isAlive(); – internet Nov 17 '15 at 11:31