I had a two bat files start.bat and stop.bat for starting and stopping SOLR server manually, Is it possible for me to create a windows serive which will call start.bat on starti
Consider Solr Multicore feature with Tomcat. Each core is like a fully fledged installation, "separate configurations and indexes, with their own config and schema for very different applications, but still have the convenience of unified administration" http://wiki.apache.org/solr/CoreAdmin
Even if you dont use multiple indexes, it's much more elegant to set up. Solr is available on startup if Tomcat is set that way. I assume you are using Solr 1.4.
You need to do these steps:
Overview
c:\solr
|-lib
|-solr.war
|-solr.xml
solr.xml has the following contents
<?xml version="1.0" encoding="UTF-8" ?>
<solr persistent="false" sharedLib="lib">
<cores adminPath="/admin/cores">
<core name="myindex" instanceDir="myindexdir" />
</cores>
</solr>
The core parameter specifies a new core. The attributes specify that for serving http//localhost:8080/mysearchapp/myindex, the index directory is myindexdir, which brings us to the next step.
Overview
c:\solr
|-lib
|-solr.war
|-solr.xml
|-myindexdir
|-bin
|-conf
|-data
Create the file mysearchapp.xml
Context docBase="c:\solr\solr.war" debug="0" crossContext="true" >
<Environment name="solr/home" type="java.lang.String" value="c:\solr\" override="true" />
</Context>
Restart tomcat and open http://localhost:8080/mysearchapp/ If all goes well it will display
Welcome to Solr!
Solr Admin myindex
Now do your operations on your core like http://localhost:8080/mysearchapp/myindex/select?q=MY-QUERY
Solr runs on top of a Servlet container like Tomcat. So for starting Solr you have to configure Solr with your Servlet container and then start.
Yes you can of course create a Windows Service. However you have not mentioned which Servlet container are you using for running Solr?
If it is Apache Tomcat here you go:
1. Just go to tomcat/bin folder from command prompt
2. Say service.bat install
3. You can see the service being listed in the Microsoft Services
Application
4. Right click on the service and add solr home (in Start
parameters). For an example if your Solr home is in D drive then:
-Dsolr.solr.home="D:\solr"
5.You are done. Just right click on the service, start it or even you can set
it to start automatically when your system starts.