To install CommandLine as a service, proceed as follows:
Download the JSL archive from this website.
Unzip it in the directory of your choice.
Go to the bin folder.
If the jsl_static64.ini file does not exist, copy the jsl64.ini file and rename it to jsl_static64.ini.
Copy the jsl_static64.ini and jsl_statif64.exe files at the root of the CommandLine installation directory.
Open the jsl_static64.ini file to edit it.
At the beginning of the file, you can see different names:
appnamecorresponds to the name of your application,
servicenamecorresponds to the name you want to give to the service and
displaynamecorresponds to the name that will be displayed when creating the service.
If you are not satisfied with those default names, edit the part that is after the = sign according to your needs.
Under this area, you can see that, by default, the
JAVA_HOMEenvironment variable is pointing towards the JRE path.
[java] ;Path to the java runtime used ;If this option is not used the default from the registry will be used ;jrepath=..\..\..\jdk16 jrepath=C:\Program Files\Java\jreX.X.X_XX
This path is set in the [java] part of the .ini file. If the default path is not the path of the installation directory of your application, edit the part that is after the = sign and write this path. In this example, X.X.X_XX refers to the version of Java.
Uncomment the following line to define the type of JVM to be used:
Next time the service starts, the jvm.dll file located in the <Java_Path>/jre/bin/server directory will be used.
Save your changes and close the file.
Configuring the CommandLine parameters
To configure the CommandLine parameters that are passed to the Java application, you have to edit the last lines of the jsl_static64.ini file which indicate the path to different files (such as configuration files, .jar files and/or java libraries).
To do so, edit the parameters as shown below:
params = 14 param00 = -Xms64m param01 = -Xmx1024m param02 = -XX:MaxMetaspaceSize=256m param03 = -jar param04 = <CommandLinePath>\plugins\org.eclipse.equinox.launcher_X.X.X.vXXXXXXXX.jar param05 = -nosplash param06 = -application param07 = org.talend.commandline.CommandLine param08 = -consoleLog param09 = -data param10 = <CommandLinePath>\commandline-workspace param11 = startServer param12 = -p param13 = 8002
where <CommandLinePath> refers to the installation directory of the CommandLine application.
Note that the first parameter indicated is named "param00" and not "param01", and that the use of quotes is not required around strings holding spaces. Note also that every parameter value of the command line must be indicated in a separate parameter.
Installing the service
Open a CMD window in Administrator mode.
Change the directory to the CommandLine installation directory.
Type in the following command:
This command debugs the CommandLine service. It starts, you can now check that the <CMDLINE_DATA_DIR>\commandline-workspace directory has been created as well.
Stop execution by pressing Ctrl+C.
The service stops, and the message
In the CMD window, type in the following command:
The CommandLine service is created and can be viewed by selecting Control Panel > Administrative Tools > Services in the Start Menu of Windows.
Note that, when shutting down or rebooting Windows, the CommandLine service does not stop. In order to avoid issues during start-up, you need to stop the service before shutting down or rebooting your machine.