I've been looking at different articles, examples for hours and have successfully completely confused myself. I am trying to use YAJSW as a service wrapper and install my Executable JAR file as a windows service. I used to use Tanukisoft's community edition wrapper and it worked wonderfully, but the 64-bit Windows version isn't available in CE.
I suppose I have a few questions.
- In the old software, I didn't need to Implement WrapperListener. Is this necessary for YAJSW?
- If so, are there any good examples? I've seen a few, but my application doesn't return anything from the main class. It's main class is a constant running URL connection reading input from a REST API and spawning a thread to process the information received. It does have a shutdown hook for a clean exit.
- Is there an easy way to translate Tanukis' configuration (below) into YAJSW's keeping the same functionality?
set.JAVA_HOME=C:/Program Files/Java/jre1.8.0_181
set.APP_HOME=G:/ProgFolder
wrapper.lang.folder=%APP_HOME%/lang
wrapper.java.command=java
wrapper.java.mainclass=org.tanukisoftware.wrapper.WrapperSimpleApp
# Java Classpath (include wrapper.jar) Add class path elements as
# needed starting from 1
#wrapper.java.classpath.1=../lib/wrappertest.jar
wrapper.java.classpath.1=%APP_HOME%/lib/wrapper.jar
wrapper.java.classpath.2=%APP_HOME%/RESTReader.jar
wrapper.java.classpath.3=%APP_HOME%/lib/javax.mail.jar
wrapper.java.classpath.4=%APP_HOME%
# Java Library Path (location of Wrapper.DLL or libwrapper.so)
wrapper.java.library.path.1=%APP_HOME%/lib
# Java Bits. On applicable platforms, tells the JVM to run in 32 or 64-bit mode.
wrapper.java.additional.auto_bits=TRUE
# Java Additional Parameters
wrapper.java.additional.1=-Dlog4j.configurationFile=file:/%APP_HOME%/conf/log4j2.xml
wrapper.java.additional.2=-Dorg.tanukisoftware.wrapper.WrapperSimpleApp.waitForStartMain=FALSE
# Application parameters. Add parameters as needed starting from 1
#wrapper.app.parameter.1=
wrapper.app.parameter.1=com.my.org.RESTReader.EventReg
wrapper.jvm_exit.timeout=120
wrapper.shutdown.timeout=120
# Name of the service
wrapper.name=RESTReader
# Display name of the service
wrapper.displayname=REST Alarm Manager
# Description of the service
wrapper.description=REST Alarm Manager
# Mode in which the service is installed. AUTO_START, DELAY_START or DEMAND_START
wrapper.ntservice.starttype=DELAY_START
# Allow the service to interact with the desktop.
wrapper.ntservice.interactive=false
First Time Install (i.e. no existing service installed on host)
java -jar yourExecutableJar.jar
genConfig [processId]
where processID is the one you determined beforeinstallService in target-dir\yajsw\yajsw-stable-majorversion.minorversion\bat
startService in target-dir\yajsw\yajsw-stable-majorversion.minorversion\bat
Update Instructions