Start server from Java code

Posted on 2011-10-12
Last Modified: 2012-05-12
I want to start my rabbitmq server from java code.

This is what I do from the command line:
C:\Program Files (x86)\RabbitMQ Server\rabbitmq_server-2.5.1\sbin\rabbitmq-service.bat" start

If possible, please provide some sample code. Thanks!
Question by:dshrenik
    LVL 86

    Accepted Solution


    Author Comment

    Do I create a .bat to execute the command?
    If yes, can you tell me how? Thanks!
    LVL 86

    Expert Comment

    Well you can use a .bat, yes ( i thought you were already). Try
    Process p = Runtime.getRuntime().exec(new String[] { "cmd.exe", "/c", "start", "C:\\Program Files (x86)\\RabbitMQ Server\\rabbitmq_server-2.5.1\\sbin\\rabbitmq-service.bat", "start" });

    Open in new window


    Featured Post

    Threat Intelligence Starter Resources

    Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

    Join & Write a Comment

    For customizing the look of your lightweight component and making it look opaque like it was made of plastic.  This tip assumes your component to be of rectangular shape and completely opaque.   (CODE)
    Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
    Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
    Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now