4

I need some way of starting my Java application without forcing the user to run the application manually. I'm not entirely sure how I would do it, can anyone provide any assistance?

RustyTheBoyRobot
  • 5,670
  • 4
  • 33
  • 53
Jaccob
  • 217
  • 1
  • 4
  • 13
  • 1
    Assigning it to what? – Sotirios Delimanolis Sep 18 '13 at 14:06
  • Believe he wants to programmatically assign a program to run on start-up. –  Sep 18 '13 at 14:09
  • 1
    @SotiriosDelimanolis I think he means manually assigning it to run at startup. Ending sentences with prepositions. – Cruncher Sep 18 '13 at 14:09
  • Assigning in the other sense. Should be read "running a java application at startup without manually clicking it to run it or scheduling a task for startup." He wants code to automatically run his program – jonhopkins Sep 18 '13 at 14:09
  • 2
    I don't think there's a platform-independent way to do this, what operating system or systems do you need this for? – Ian Roberts Sep 18 '13 at 14:26
  • Possible duplicate of [Run Java application at Windows startup](https://stackoverflow.com/questions/5953525/run-java-application-at-windows-startup) – Ravi Parekh May 24 '17 at 09:11

2 Answers2

2

Run it as a Windows Service. It's the way to go.

For various ways to run it as a service, check out the answers to the following questions:

You can also read this article.

Community
  • 1
  • 1
James Dunn
  • 7,548
  • 11
  • 47
  • 81
1

use registry editor to add path of .exe file to startup goto Run from start menu, type regedit.exe

then navigate to HKEY_CURRENT_USER / SOFTWARE / MICROSOFT / WINDOWS / CURRENT_VERSION / RUN

on the right side, create a new string value with

name = "anything" and value = java.exe -jar "complete path of the file"

press ok to save the registry entry, restart your pc to see effect

sedflix
  • 216
  • 2
  • 12