问题
I have Artifactory artifactory-oss-6.10.1, that I try to install as Windows service.
First problem I encounter is that the installService.bat has the lines
:gotJdkHome
if not exist "%JAVA_HOME%\jre\bin\java.exe" goto noJavaHome
if not exist "%JAVA_HOME%\jre\bin\javaw.exe" goto noJavaHome
I have JDK 12 installed and set as JAVA_HOME, but my JDK installation has no jre folder. I re-downloaded the jdk 12 from oracle, but the installation gives no jre folder
After I removed the jre path of the file, the installation fails due to a missing tomcat (?) (it just say that it cannot find the path).
So do I need to additionally install tomcat ? Because, when i simply start the artifactory.bat, Artifactory starts up.
So how can I install Artifactory as windows service ?
回答1:
I struggled with this as well and managed to find a solution to get the service installed.
Open your InstallService.bat file. Locate the :gotJdkHome section. Remove \jre from the pathes like the following:
:gotJdkHome
if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaHome
if not exist "%JAVA_HOME%\bin\javaw.exe" goto noJavaHome
if not exist "%JAVA_HOME%\bin\javac.exe" goto noJavaHome
if not "%JRE_HOME%" == "" goto okJavaHome
set "JRE_HOME=%JAVA_HOME%"
Then you will be able to run the InstallService.bat and the service will be installed.
But you will not be able to launch the service because the JVM argument "java.endorsed.dirs" is not supported from Java 10.
You have to remove it from the following line in the bottom of the file:
"%EXECUTABLE%" //US//%SERVICE_NAME% --JvmOptions "-Dcatalina.base=%CATALINA_BASE%;-Dcatalina.home=%CATALINA_HOME%;-Djava.endorsed.dirs=%CATALINA_HOME%\endorsed" --StartMode jvm --StopMode jvm
in order to get
"%EXECUTABLE%" //US//%SERVICE_NAME% --JvmOptions "-Dcatalina.base=%CATALINA_BASE%;-Dcatalina.home=%CATALINA_HOME%" --StartMode jvm --StopMode jvm
Now your service will be able to start up.
来源:https://stackoverflow.com/questions/56251364/artifactory-cannot-be-installed-as-windows-service