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?
-
1Assigning it to what?Sotirios Delimanolis– Sotirios Delimanolis2013-09-18 14:06:42 +00:00Commented Sep 18, 2013 at 14:06
-
Believe he wants to programmatically assign a program to run on start-up.user2577094– user25770942013-09-18 14:09:11 +00:00Commented Sep 18, 2013 at 14:09
-
1@SotiriosDelimanolis I think he means manually assigning it to run at startup. Ending sentences with prepositions.Cruncher– Cruncher2013-09-18 14:09:12 +00:00Commented Sep 18, 2013 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 programjonhopkins– jonhopkins2013-09-18 14:09:22 +00:00Commented Sep 18, 2013 at 14:09
-
2I don't think there's a platform-independent way to do this, what operating system or systems do you need this for?Ian Roberts– Ian Roberts2013-09-18 14:26:32 +00:00Commented Sep 18, 2013 at 14:26
|
Show 1 more comment
2 Answers
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:
- Install java program as a windows service: Alternative to JavaService?
- How to create a windows service from java app
You can also read this article.
Comments
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