I have created a form to login and password in java swing. I want this application automatically start when the system restart. Means if I restart my computer then my application must run. How to get this

Thanks Sunil Kumar Sahoo


Make a shortcut to your application in the Startup group of the Start menu.

(There are other ways, eg. adding keys to the registry, but the great thing about the Startup group is that it's easy to make a shortcut there "by hand", and it's visible - you can see it and control it as an ordinary user.)

How to make shortcut to my application in the Startup group of the Start menu via java programming
I cannot create shortcut by hand. actually i want distribute that application to my friends
@Sunil: Here's one way: http://alumnus.caltech.edu/~jimmc/jshortcut/index.html
+3  A: 

It depends on what OS you are on. For Windows, use the java equivalent of "RegCreateKeyEx" (http://msdn.microsoft.com/en-us/library/ms724844%28VS.85%29.aspx) to add a key to "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" that points to your application's location on the filesystem. On linux, depending on your desktop environment, there is usually a ".autostart" folder in your home folder where you can point to your application. You would need to look at specific distribution documentation to be certain though. I am unsure on how to do this on OSX, but a quick google search should tell you.