Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to configure Java service in Windows 64-bit environment

2025-03-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

How to configure Java services in Windows 64-bit environment? I believe many inexperienced people don't know what to do about it. Therefore, this paper summarizes the causes and solutions of the problems. Through this article, I hope you can solve this problem.

Recently, there is a task that needs to remotely start and debug programs under the Windows64 server, so we need to inject a deamon service into the Windows server. We all know that it is very easy to make a background service in the Linux environment. Nohup & can solve the problem quickly, but the windows environment always has multiple tribulations.

At first, I asked a friend, he replied that it was not a service, but to write a Pathon package outside java, then compile it into exe, and add it during startup. I thought it was a bit troublesome and needed a circle to start the tune.

First search Java windows service, recommend * Wrapper, and the famous ActiveMQ also uses his service. After verification, it is very simple to configure: copy wrapper.exe, wrapper.dll, wrapper.jar to your own directory, and configure a wrapper.conf for testing.

Wrapper.exe-c wrapper.conf

Find a problem, need a licence key, need to buy.

There may be a way to crack it, but after reading a foreigner saying that wrapper is not free for windows 64-bit, and recommending Procrun, he decided to switch to this position, plus the famous Tomcat also uses it to do the service. The entire configuration is as follows:

1. Download prunsrv

Http://archive.apache.org/dist/commons/daemon/binaries/windows/

Download commons-daemon-1.0.8-bin-windows.zip

It is not easy to find this on the Internet. Later, I found this in commons-daemon-1.0.8-bin-windows.zip. I usually find http://commons.apache.org/daemon/download_daemon.cgi, but there is no prunsrv.exe in it.

After unpacking, the 64-bit machine uses amd64/prunsrv.exe

two。 Copy files after decompression

A. Copy commons-daemon-1.0.8-bin-windows/amd64/prunsrv.exe to your app path

This is the execution procedure for doing the service.

B. copy commons-daemon-1.0.8-bin-windows/prunmgr.exe and renamed yourappname.exe

Monitor the configuration and running programs of the service

3. Write two scripts

a. One installs bat

Echo off set LIB_HOME=* set APP_HOME=*% APP_HOME%\ prunsrv.exe / / IS//StartService-- DisplayName= "StartService"-- Description= "Start a server." ^-- Install=%APP_HOME%\ prunsrv.exe-- Jvm=%JAVA_HOME%\ jre\ bin\ server\ jvm.dll-- JvmMs=256-- JvmMx=1024 ^-- StartMode=jvm-- Startup=auto- -StopMode=jvm-StartClass=-StartParams= ^-Classpath=%LIB_HOME%\ * .jar ^-- LogPath=-- LogPrefix=

^ is a line break for the windows command to avoid writing excessively long commands on one line. (Linux is\)

Execute this script in the dos environment, after execution

In this way, you can see the service named StartService in Control Panel-> Administrative tools-- > Services.

Note:-- do not save% APP_HOME%\ after install=, or you will report that the file cannot be found

b. Write a uninstall script

@ echo off set APP_HOME=*% APP_HOME%\ prunsrv.exe / / DS//StartService

This can uninstall the install service.

c. For more detailed configuration documentation, see the apache documentation.

After reading the above, have you mastered how to configure Java services in Windows 64-bit environment? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 245

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report