P
P
parkito2017-02-24 10:13:15
Java
parkito, 2017-02-24 10:13:15

How to enable and disable auto-start of the program at system startup?

Hello. There is a javaFX application, it is necessary to give users the right to add and remove the program from autorun. Can you please tell me how this can be done in code? Do I need to work with the registry or is there a winAPI?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
Evgeniy Dikevich, 2017-02-24
@tonyslark

For a specific user, you can create a parameter with the full path to your program in the HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run branch
. There should be no problems with rights.

B
bsf, 2017-02-24
@bsf

If we are talking about autostart of the program itself, then you can programmatically create / delete a shortcut to the jar in
C:\Users\User\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
Once the application has already been written, then create or delete the file is not will be labor.
For the registry and JNA, you will need to raise the rights of an ordinary user.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question