Procrun is a set of libraries and applications that allow Java applications to run in win.
Procrun Service Application
Prunsrv is a service program that allows an application to run as a Service. It can convert any application to run as a service.
Procrun monitor application
Prunmgr is a visualization application used to monitor and configure the procrun service.
Available command line options:
// Es // edit the service configuration. This is a default operation. If no option is provided, the executable file is named w.exe.
// MS // The Service monitor places the icon in the system tray
Command Line Parameters
The format of each command line command is // XX // service name
The available command line options are:
/// Ts // run the service as a console application, which is the default operation. The executable file is called after the service name w.exe.
// Rs // The Running Service is called only from the Service Manager.
// SS // stop the service
// Us // Update Service Parameters
// Is // install the service
// DS // Delete the service. If the service is running, it is stopped.
Command Line Parameters
The prefix of each command line parameter is --. If the command line prefix is ++, the parameter will be appended with an existing option. If an environment variable with the same name is provided as a command line parameter, but the prefix is Pr _, it has priority. For example:
Set pr_classpath = XX. Jar
Equivalent
-- Classpath = XX. Jar
As a command line parameter.
Default Parameter Name Description
-- Description Description of the service name (up to 1024 characters)
-- Displayname: name of the service displayed by the service name
-- Install procrun.exe // Rs // servicename
-- Startup manual Service Startup Mode, automatic or manual
-- Type can be an interactive desktop program. Use and this option is limited to the local system account
-- Dependson: list service dependencies. Dependent service usage # Or; Character Segmentation
-- Environment lists the environment variables provided to the Service in the format of key = value. Use # Or; Character Segmentation
-- User account used to run the program. It is only used for startmode Java or EXE, so that the program runs as a service without the permission as a service account.
-- Password of the account specified by the user
-- Serviceuser specifies the account name for running the service. The format is domainname \ Username. The service process logs on with this account. If the account belongs to the built-in domain, the format of. \ USERNAME can be used.
-- Servicepassword: password of the account specified by -- serviceuser
-- Javahome java_home: Set a java_home environment variable different from that of java_home.
-- JVM automatically uses automatic or full-path JVM. dll. You can use environment variables
-- Jvmoptions-xrs lists the parameters passed to the JVM in-D or-x format. Use # Or; to separate these options. If you need to embed # Or; characters, enclose them with single quotation marks.
-- Classpath: Set the Java class path
-- Jvmms initial memory pool, in MB
-- Jvmmx maximum memory pool, in MB
-- Jvmss thread stack, in KB
-- Startimage the executable program to be started
-- Startpath
-- Startclass
-- Startparams: lists the parameters passed to startimage or startclass. Use # Or.
-- Startmethod main if the method name is not main
-- Startmode executable can be a JVM Java or EXE program
-- Stopimage: the executable program is used to send a signal to stop the service.
-- Stoppath: Specifies the job path for stopping a program.
-- Stopclass: class for stopping services
-- Stopparams: lists the parameters passed to stopimage or stopclass. Use # Or.
-- Stopmethod main if the method name is not main
-- Stopmode executable can be a JVM Java or EXE program
-- Stoptimeout no timeout defines a duration in seconds. procrun waits for the service to exit gracefully.
-- Logpath working path
-- Logprefix jakarta_service defines the Service Log File Name
-- Loglevel info defines log level error, info, warn, debug
-- Stdoutput: Specifies the name of the stdout file to be redirected.
-- Stderror: Specifies the name of the stderr file to be redirected.
Install services
You need to use the // is // Parameter
Install the service named 'testservice'
Prunsrv // is // testservice -- displayname = "Test Service" \ --install1_prunsrv.exe -- JVM = auto -- startmode = JVM -- stopmode = JVM \ -- startclass = org. apache. somestartclass -- startparams = arg1; arg2; arg3 \ -- stopclass = org. apache. somestopclass -- stopparams = arg1 # arg2 \
Update Service
You need to use the // us // Parameter
Update the service named 'testservice'
Prunsrv // us // testservice -- Description = "some dummy test service" \ -- startup = auto -- classpath = % classpath %; test. Jar
Remove Service
You need to use the // DS // parameter. If the service is running, it will stop it and then delete it.
Remove a service named 'testservice'
Prunsrv // DS // testservice
Debugging Service
Run the service in Console mode. You need to use the // ts // parameter. The service can be interrupted using Ctrl + C or Ctrl + break. If you change prunsrv.exeto testservice.exe, you only need to execute the testservice.exe. This command mode is executed by default.
Run the service named 'testservice' in Console mode
Prunsrv // ts // testservice [Additional arguments]