How to Run Solr 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 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

Taking Solr 5.0.0 as an example, first, extract Solr and NSSM to the following path on your file system (adapt paths as necessary).

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 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 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.

    • Abdulsamad

      Soundarya how you resolved this error

      • Abdulsamad

        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. and also i checked NSSM, JAVA also environment variable please tell me how to resolve this issue.

  • Joe

    great article! once the solr is up and running, any instructions on how to crawl & index a web site? tx.

    • Have you tried using a web crawler? I recommend you try ours (free/open-source): It supports a few different search engines, including Solr (see

      • Joe

        I am able to use the web crawler and have also added the committer configuration into the minimum-config,xml. I have created a core called mycore and in the configuration file I am specifying http://localhost:8983/solr/#/mycore but I don’t see any documents indexed under Solr. Can you please advise what I could be missing? Thanks

        • That URL does not appear to be a valid Solr URL, but rather the URL to the Solr Admin UI. Try without the # maybe? If you try a query in the Admin UI you should see at the top of the results what the actual Solr URL is. If you suspect an issue with the Solr Committer, please report it here:

          • Joe

            Tried without the # and seeing no difference, and trying the URL without the # in a browser gives a 404. I think the issue is with not passing the right solr URL. Will further investigate but if you can think of anything else please let me know. Thanks again.

          • What URL do you use to query Solr from your application? That would be the URL, minus the “select” part. Since this is not related to this article (starting Solr as a service), please use GitHub for community support:

  • Abdulsamad

    Can i do the same for Cassandra?

    • NSSM is not tied to any particular application so in theory, yes, you could use it with pretty much any app. I encourage you to try it and let us know.

  • Richard

    I have Solr6 & NSSM running on my Windows 10 VM and on the last update to Windows it has stopped starting up. I am getting the below error in Event Properties. I tried to switch from Local System to a Admin account for the service but that did not help.

    Any ideas – I seem to be out of them.

    Service TMDSolr6 action for exit code 3221225794 is Restart. Attempting to restart C:Program Files (x86)TMDSolr6binsolr.cmd.

    • Olivier M.

      I have the some problem since a recent windows update.
      Program C:solr-5.5.1binsolr.cmd for service solr5 exited with return code 3221225794.

      • Richard

        you find the problem, let me know. I gave up and run it from a regular command prompt.

      • People are often reporting this error as being related to permissions. It can mean the account you use to run it has no rights to execute Solr.

        Try running the service as a user with admin rights (as opposed to the default local system account). You should be able to do that at install time, in the “Log on” tab of NSSM service installer.

      • Thomas Werner

        I have the same problem and can’t find a solution for it. Does someone found a solution to run Solr 5.5.1 as a windows service on Windows 10? I do run the service as a local service user with admin privilegs.

    • Richard

      Well, I just move Solr6 to the root of C: from C:Program Files

      I was using a local admin account – that would not help. NSSM worked up until I updated Windows 10.

      • From the NSSM download page (, they acknowledge the issue with Windows 10 Creators Update and offer a solution, reprinted here:

        “2017-04-26: Users of Windows 10 Creators Update should use prelease build 2.2.4-101 to avoid an issue with services failing to start. If for some reason you cannot use that build you can also set AppNoConsole=1 in the registry, noting that applications which expect a console window may behave unexpectedly.”

        • Richard

          Nice update / find! thanks!