• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Add application to start up

 
Mamu Jan
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I'm developing an application in which I want to give my user an option to add my application to the windows start up. So, is there any API which can add a key (in this case my application) to the registry.

Thanx
 
Scott Selikoff
author
Saloon Keeper
Posts: 4010
18
Eclipse IDE Flex Google Web Toolkit
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The java.util.prefs.Preferences API.

For example see: http://forum.java.sun.com/thread.jspa?threadID=666927&messageID=3902531

The windows registry key you need to add is:

HKCU\Software\Microsoft\Windows\CurrentVersion\Run\<YourKeyAsAString>

with the value being the executable path.
 
Alan Moore
Ranch Hand
Posts: 262
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Preferences API can only read/write Registry keys under the keysTo access any other part of the Registry from within a Java program, you have to use JNI.
 
Mamu Jan
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Alan Moore:
The Preferences API can only read/write Registry keys under the keysTo access any other part of the Registry from within a Java program, you have to use JNI.


I've never used JNI before. Please can you guide me??!
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15216
36
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You don't have to program the whole thing yourself - have a look on for example http://sourceforge.net and do a search for a Java library to access the Windows registry.
 
Stuart Ash
Ranch Hand
Posts: 637
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't think you need any registry write at all, just copy the shortcut to the appropriate startup folder, say C:\Documents and Settings\All Users\Start Menu\Programs\Startup. And you should be able to get it. Let us know if it worked.

 
Mamu Jan
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok thanx guys ! Problem solved. Found dis code snippet in da Sun Developer forum.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic