Tika >2.4.1 allows the ability to install Tika Server as a Windows Service via apache Daemon.
You will need to download and install Apache Daemon https://commons.apache.org/proper/commons-daemon/
Once downloaded and unzipped it will be possible to install Tika as a Window Service, below is an example installation command
prunsrv.exe //IS//TikaServer ^ --DisplayName="Tika Server" ^ --Description="Tika Server" ^ --Install="G:\commons-daemon-1.3.1-bin-windows\amd64\prunsrv.exe" ^ --Startup=manual ^ --LogPath="G:\logs" ^ --Jvm="C:\Program Files\Java\jdk1.8.0_301\jre\bin\server\jvm.dll" ^ --Classpath="G:\Tika\tika-server-standard-2.4.1-Stop.jar" ^ --StartMode=jvm ^ --StartClass=org.apache.tika.server.core.TikaServerCli ^ --StartMethod=main ^ --StopMode=jvm ^ --StopClass=org.apache.tika.server.core.TikaServerCli ^ --StopMethod=stop ^ ++StartParams=-c#"g:\tika\tika-server-config-default.xml"
More details can be found here on the available service installation options :
https://commons.apache.org/proper/commons-daemon/procrun.html
For StartParams an absolute path is necessary to pass in a config file (Daemon spawns java from it's installation folder so an absolute path is required)
In the config file again absolute path to the log4j configuration file:
<?xml version="1.0" encoding="UTF-8"?> <properties> <server> <params> <port>9998</port> <host>localhost</host> <id>my-id</id> <digest>sha256</digest> <digestMarkLimit>1000000</digestMarkLimit> <logLevel>info</logLevel> <returnStackTrace>false</returnStackTrace> <noFork>false</noFork> <taskTimeoutMillis>300000</taskTimeoutMillis> <minimumTimeoutMillis>30000</minimumTimeoutMillis> <taskPulseMillis>10000</taskPulseMillis> <maxForkedStartupMillis>120000</maxForkedStartupMillis> <maxRestarts>-1</maxRestarts> <maxFiles>100000</maxFiles> <javaPath>java</javaPath> <forkedJvmArgs> <arg>-Xmx4g</arg> <arg>-Dlog4j.configurationFile=g:\tika\log4j_server.xml</arg> </forkedJvmArgs> </params> </server> </properties>
Here is a quick example of how to install:
Installation bat file:
Run CMD as Admin, navigate to the daemons installation folder and run the install batch file created above.
TikaServer should now be installed as a Windows service and be runnable: