How to Run Solr5 as a Service on Windows

Posted on March 25, 2015 by in Latest Articles

In this tutorial, I will show you how to run Solr 5.0.0 as a Microsoft Windows service. Up to version 5.0.0, it was possible to run Solr inside the Java web application container of your choice. However, since the release of version 5.0.0, the Solr team at Apache no longer releases the solr.war file. This file was necessary to run Solr from a different web application container such as Tomcat. Starting with version 5.0.0, Solr will be distributed only as a self-contained web application, using an embedded version of Jetty as a container.

Unfortunately, Jetty does not have a nice utility like Tomcat’s to register itself as a service on Microsoft Windows. I had to research and experiment to come up with a clean and easily-reproduced solution. I tried to follow the Jetty website instructions and adapt them to make Jetty work with Solr, but I was not able to stop the service cleanly. When I would request a “stop” from the Windows Service Manager, the service was flip-flopping between “starting” and “stopping” statuses. Then I discovered a simple tool, NSSM, that did exactly what I wanted. I will be using the NSSM tool in this tutorial.

Applications to Download

File System Setup

First, extract Solr 5 and NSSM to the following path on your file system.

Setting up Solr as a service

On the command line, type the following:

Fill out the path to the solr.cmd script, and the startup directory should be filled in automatically. Don’t forget to input the -f (foreground) parameter so that NSSM can kill it when it needs to be stopped or restarted.

Application tab on NSSM Service Editor screen capture to show path to Solr start script

The following step is optional, but I prefer having a clean and descriptive name in my Windows Service Manager. Under the details tab, fill out the Display name and Description.

Details tab for NSSM service installer for setting up Solr 5 as a service on Microsoft Windows

Click on Install service.

NSSM confirmation box saying "Solr5" installed successfully

Check that the service is running.

Microsoft Windows Component Services Running Solr 5

Go to your favorite web browser and make sure Solr 5 is up and running.

Solr 5 running as a service on Microsoft Windows


I spent a few hours finding this simple solution, and I hope this tutorial will help you set up Solr 5 as a Microsoft Windows service in no time. I invite you to view the solr.cmd file content to find the parameters that will help you customize your Solr setup. For instance, while looking inside this file, I realized there I needed to add the -f parameter to run Solr in the foreground. That was key to get it running the way I needed it.

If you successfully used a different approach to register Solr 5 as a service, please share it in the comments section below.


  • For Solr Cloud, this tool also works great with Zookeeper to register the “zkServer.cmd” script as a Windows service.

    • G Naresh Kumar

      Hi Pascal,

      Thanks for quick reponse!

      There are no errors.Its just warning.
      Anyways I figured out that JAVA_HOME environment variable is not set in that server.
      Service started after setting it.


    • manohar

      How to setup multiple solr clouds with zookeeper in windows servers.I am not able to setup multiple solr clouds with zookeeper in different windows machines.Please provide me steps.

      • Roby

        Excuse me,Are you finished use the solr clouds on different windows?

  • dalenewman

    Thank you. This article helped me 🙂


    Thanks a ton…that was really helpful!

  • SFAC

    Thank you so much , even solr5.4 can be set up by this way

  • G Naresh Kumar

    This works fine in local.

    Where as in Windows Server 2012 R2, service is getting paused and not starting. Below warning message logged in Events.
    ” Service solr5.4 ran for less than 1500 milliseconds. Restart will be delayed by 32000 milliseconds.”

    Any help on how to resolve this issue?


    • Do you have more errors in the Windows Event Viewer? I find sometimes errors will show up there for failing services when not showing anywhere else.

      • G Naresh Kumar

        Hi Pascal,

        Thanks for quick reponse!

        There are no errors.Its just warning.
        Anyways I figured out that issue is JAVA_HOME environment variable is not set in that server.
        Service started after setting it.


    • Mike

      Probably thats because you have SOLR running on the same port already. Try “solr stop -app” and then restart the service

  • Edwin Stauthamer


  • Mahendra Sahni

    Dear All as per above guidance I have installed Solr 5.5 realy it a great help to setup Solr on windows server 2008 R2 Standard edition

  • Ritesh

    How to create solr service with 3 different Solr VM’s and 3 different ZooKeeper VM’s

  • Zaelin

    Is there a way to install ENTIRELY through a command line? All I need are the application and details tabs.

  • Raúl

    Thanks a lot. This worked pretty well.
    Actually, the argument -f is very important (I struggled a bit myself because it was not working without that argument).

  • Vijay Bhandari

    Thanks Martin,

    While I had installed the old solr versions multiple times, I have been struggling to setup 6.2 until I came across this post. You sir, are the man. Thanks!


  • home

    Thanks for the nice guideline. I could able to install the solr service (solr 6.2)successfully. But when tried to start the solr service, getting following error : The solr62 service failed to start due to the following error:
    solr62 is not a valid Win32 application.
    I have followed the document above, and copied the nssm as well as solr to c:program files.
    Can someone pls provide any suggestion reg how to solve the error.

    • Stephen Jacob

      which version of Java are you running (32 bit or 64bit)? Please ensure that each component (Java, NSSM) are running the same bit version (32bit or 64bit).

  • Soundarya Ganesan

    while starting solr on services im getting following error “windows cannot start solr on local computer This could be the internal service error or internal windows error.

    Can someone pls provide any suggestion to solve the error.

    • Stephen Jacob

      Please make sure that you are running the correct BIT version (32bit or 64bit) for each component (Java, NSSM, Solr). So if you are running Java in 64bit, you will need to use the 64bit version for NSSM. Also, you might need to configure the JAVA_HOME in your environment variables.