I am trying to run a Java program as a Windows service and my log file shows this error. I guess there is an error in providing the path but I am not able to figure it out.
2017-06-27 15:43:21 Commons Daemon procrun stderr initialized
java.lang.NoClassDefFoundError: ajavaservice/DemoService
Caused by:
java.lang.ClassNotFoundException: ajavaservice.DemoService
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
My batch file
set SERVICE_NAME=JavaService
set PR_INSTALL=C:\Eclipse\JavaService\prunsrv.exe
REM Service log configuration
set PR_LOGPREFIX=JavaService
set PR_LOGPATH=C:\Logs
set PR_STDOUTPUT=C:\Logs\stdout.txt
set PR_STDERROR=C:\Logs\stderr.txt
set PR_LOGLEVEL=Error
REM Path to java installation
set PR_JVM=C:\Program Files\Java\jre7\bin\client\jvm.dll
set PR_CLASSPATH=DemoService1.jar
REM Startup configuration
set PR_STARTUP=auto
set PR_STARTMODE=jvm
set PR_STARTCLASS=com.service.demoservice.DemoService
set PR_STARTMETHOD=start
REM Shutdown configuration
set PR_STOPMODE=jvm
set PR_STOPCLASS=com.service.demoservice.DemoService
set PR_STOPMETHOD=stop
REM JVM configuration
set PR_JVMMS=256
set PR_JVMMX=1024
set PR_JVMSS=4000
set PR_JVMOPTIONS=-Duser.language=DE;-Duser.region=de
REM Install service
prunsrv.exe //IS//JavaService