Score:1

create a service for running a executable jar with out any 3rd party

de flag

I have spring boot executable jar file which can run into any command prompt by calling java -jar filename.jar.

I want to create a service with out downloading any external libraries for the above code snippet.

Help me if there is a strait forward way.

in flag
ETL
What OS? What version?
Khaled avatar
de flag
Its windows 10 pro
Score:1
cn flag

Simple (and recommended): Download and use NSSM. Or use SC to create a service without downloads.

Using SC to create a service from command line

The SC command communicates with the Windows Service Controller and installed services. When used with its create command option, you can use it to create a Windows service under which your binary will run. But the binary must be created for this (so Windows knows it will respect API calls and gives correct status information).

The SC Create command uses the following format:

sc create serviceName binpath="path\to\java.exe path\to\.jar" optionName= optionValue...

where:

  • create is the command to be run by SC (this command name is mandatory to create a service).
  • serviceName is the name of the Windows service to be created. This is the name given to the service key in the registry. Note that this name is different from the display name.
  • binpath is the (mandatory) parameter that specifies the path to the Win32/x64 binary. Note that a space must be used between the binpath parameter and its argument. You should also use double quotes around the argument.
  • optionName specifies optional parameters, which are described in the documentation
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.