1 Reply Latest reply on Jan 14, 2015 6:52 AM by maxandersen

    How to execute jboss-cli.bat command in java ProcessBuilder

    sujithps534

      I need to execute jboss-cli.bat --connect --command=\"deploy --force C:\Users\me\git\test\Test\build\libs\TestEAR.ear this command in java ProcessBuilder .

       

      I tried

          ProcessBuilder pb = new ProcessBuilder ( "jboss-cli.bat", "--connect", "--command","\"deploy --force C:\\Users\\me\\git\\test\\Test\\build\\libs\\TestEAR.ear\"" );

       

      But it is not executing correctly.

        • 1. Re: How to execute jboss-cli.bat command in java ProcessBuilder
          maxandersen

          This is not really the forum for it but I'll bite.

           

          Dealing with .bat files are a bitch (and one of the reasons jboss tools don't launch servers via shell nor batch scripts), but thats a nother story.

           

          I believe you need to pass each argument as individual strings, see like:

           

          ProcessBuilder pb = new ProcessBuilder ( "jboss-cli.bat", "--connect", "--command","deploy", "--force", "C:\\Users\\me\\git\\test\\Test\\build\\libs\\TestEAR.ear" );