-2

I have Java desktop application, which runs fine. I can double click on exe or run jar file and runs properly.

I want to load this application whenever system starts. How can I achieve this programmatically?

Or is there any tool available to create exe in such a manner, that once we install it creates shortcut in system startup folder.

I want it be system or code driven rather than individually placing exe in startup folder.

Zong
  • 6,160
  • 5
  • 32
  • 46
Ankur Singhal
  • 26,012
  • 16
  • 82
  • 116
  • 3
    Check out [this link](http://stackoverflow.com/questions/5953525/run-java-application-at-windows-startup) and [this link](http://stackoverflow.com/questions/4564813/how-to-start-a-java-jar-when-windows-starts) it migth help you. – edasssus Jun 17 '16 at 05:00
  • @edasssus already checked, but does not help much, does not makes clear if i need to do programmatically or use any tool for that. – Ankur Singhal Jun 17 '16 at 05:08
  • 1
    can't to try setting it up as an automatic windows service? – Sampada Jun 17 '16 at 05:21
  • @Sampada yes how cani do that, i created exe using Excelsior software. – Ankur Singhal Jun 17 '16 at 05:22

1 Answers1

0

You can set up the exe as a windows service with these steps:

  1. open command prompt as administrator

  2. type this:

sc.exe create <service_name> binPath= "<path to your exe> --service" DisplayName= "<somename>" start= "auto"

Sampada
  • 2,931
  • 7
  • 27
  • 39
  • Thanks for the help, but my problem is i want to deploy this exe on other system, they will download and just install. I cannot ask them to place manually or run command, i just want them to double click and install, and it should install as a service. – Ankur Singhal Jun 17 '16 at 05:31
  • create a batch file with first instruction to run the exe and then this commnad. Ask people to run the batch file to install your exe . – Sampada Jun 17 '16 at 05:36
  • ok got it, will try as per your suggestion. – Ankur Singhal Jun 17 '16 at 06:13