Hi all,


I wanted to create artemis broker instance via interactive mode using a Java 
application. I have written a sample code to execute the windows command and 
provide the input in an interactive mode kindly find the java file as an 
attachment.



Now if I run the command as below where all input like username, password, etc 
is given in the command itself it works fine:

String command = "<Java_home>\\jre\\bin\\javaw.exe\" -XX:+UseParallelGC 
-XX:+AggressiveOpts -Xms512M -Xmx1024M -classpath 
\"<ARTEMIS_HOME>\\java\\lib\\artemis-boot.jar\" 
-Dartemis.home=\"<ARTEMIS_HOME>\\java\" 
org.apache.activemq.artemis.boot.Artemis create --user "Administrator" 
--password "Password1" --role admin --allow-anonymous y 
\"E:\\MessagingQueueBroker1\"";



But if I run the command in interactive mode as below:

String command = "<Java_home>\\jre\\bin\\javaw.exe\" -XX:+UseParallelGC 
-XX:+AggressiveOpts -Xms512M -Xmx1024M -classpath 
\"<ARTEMIS_HOME>\\java\\lib\\artemis-boot.jar\" 
-Dartemis.home=\"<ARTEMIS_HOME>\\java\" 
org.apache.activemq.artemis.boot.Artemis create \"E:\\MessagingQueueBroker1\"";



Then it asks for the input in an interactive way, and I am providing the input 
via java code.



BufferedWriter writer = new BufferedWriter(new 
OutputStreamWriter(process.getOutputStream()));

writer.write("Administrator\n");

writer.flush();

………



It gives an exception “The pipe is being closed” while providing the password 
but it is working fine for all other parameters. Do anyone have solution w.r.t 
this issue. I want to run command in interactive mode only.



Regards,

Amith Goel.

Reply via email to