2017-12-08 1 views
1

실행 가능한 jar 파일이 있는데 sc.exe를 사용하여 Windows 서비스를 만들려고했습니다. 나는 서비스를 만들기위한 아래의 코드를 사용 :Java jars를 Windows 서비스로 실행

sc create "TestService" binPath= "C:\Program Files\Java\jdk1.6.0_03\jre\bin\java.exe -jar C:\abc\MainClass.jar" 

서비스가 생성하지만 서비스를 시작하려고 할 때 나는 아래의 오류 가지고있어 :

Error 1053: The service did not respond to the start or control request in a timely fashion. 

나중에 내가 자바 서비스 래퍼를 사용하려고를 (Community Edition), 서비스는 얼마 동안 시작되지만 매번 중지됩니다.

Advice: 
The Wrapper consists of a native component as well as a set of classes 
which run within the JVM that it launches. The Java component of the 
Wrapper must be initialized promptly after the JVM is launched or the 
Wrapper will timeout, as just happened. Most likely the main class 
specified in the Wrapper configuration file is not correctly initializing 
the Wrapper classes: 
com.MainClass 
While it is possible to do so manually, the Wrapper ships with helper 
classes to make this initialization processes automatic. 
Please review the integration section of the Wrapper's documentation 
for the various methods which can be employed to launch an application 
within the Wrapper 

사람이 내가 고객의 찌르다 ENV에 제 3 자 응용 프로그램을 사용할 수 없기 때문에 외부 소프트웨어를 사용하지 않고 Windows 서비스로 항아리를 실행할 수있는 방법을 말해 주 시겠어요 : 래퍼 로그 같은 것을 알려줍니다.

Java Service Wrapper에서 수행해야하는 다른 구성이 아닌 경우 서비스를 시작하십시오.

stackoverflow에서 이와 관련된 정보를 찾으려고했지만 아무 것도 얻지 못했습니다. stackoverflow에 아무 것도 있으면 주석에 넣어 주시기 바랍니다.

답변

0

이전에는이 ​​접근 방식을 생산적인 환경에서 사용 했으므로 사용하는 것이 안전하다는 것을 확신 할 수 있습니다.

Jar 파일은 exe로 래핑 된 다음 Windows 서비스 스케줄러에 추가됩니다 (또는이를 호출하려고합니다). Maven 프로젝트를 가지고 있다면이 작업 또한 매우 쉽습니다.

https://dzone.com/articles/installing-a-java-application-as-a-windows-service

편집 : 당신은 당신이 외부 소프트웨어를 사용할 수 없습니다 말했다. 이 방법을 사용하면 필요한 모든 것이 exe 파일에 압축됩니다. JRE를 포함하여 고객의 정책에 의해 허용되기를 바랍니다.

관련 문제