Create WSH script for running Java application as a Service
$30-5000 USD
Cerrado
Publicado hace más de 13 años
$30-5000 USD
Pagado a la entrega
I need a WSH script that will allow me to run a java application as a service.
The normal way of doing this is to:
1) ? put the command for running this application in a batch file (java -jar path\[login to view URL])
2) use the instructions provided here (<[login to view URL]>) to create a service that will run the batch file.
My problem is that the [login to view URL] is too big for my purpose. To reduce the size of my application, what [login to view URL] is doing should be done using WSH. I managed to write a WSH script that apperently does the same thing as instsvc.exe. It creates the service and configure this service as specified on the Microsoft site. My problem is that i did not manage to start the service. The WSH script that I created is below. It attempts to start Textpad as a service.
So, your work is to debug this script, get it running, and replace [login to view URL] with a batch file which in turn a Java application.
Const OWN_PROCESS = 16
Const NOT_INTERACTIVE = False
Const NORMAL_ERROR_CONTROL = 2
Dim sName, sDisplayName, sPath, sType
sName = "Malade9"
sDisplayName = "Malade9"
sPath = "C:\Users\fenkam\Desktop\WSH\[login to view URL]"
sType = "Automatic"
strComputer = "."
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set objService = [login to view URL]("Win32_BaseService")
errReturn = [login to view URL](sName, sDisplayName, sPath, OWN_PROCESS, NORMAL_ERROR_CONTROL, sType, NOT_INTERACTIVE,"NT Authority\LocalService", "")
Set WshShell = CreateObject("[login to view URL]")
myKey = "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Malade9\Application"
[login to view URL] myKey,"C:\Program Files (x86)\TextPad 5\[login to view URL]","REG_SZ"