Philip Thamaravelil wrote:Hypothetically, you could have your Java program create the batch file in the startup directory. So only an initial run of the program would be required. Just my two cents.
thats nice one ....good job...
A shortcut (.lnk) pointing to javaw.exe with proper arguments might be better, you probably don't want to display the console to the user. Making it would be a bit harder, though. In either case, you need to obtain the right location of the startup folder from Windows. Its location is not present (as of Windows 7) in environment variables and the name depends (among other things) on the version and language of the system. For both of these task you'll probably have to call Windows system functions, should be doable with JNA.
However, you stated you wanted your program to run when Windows boot. This solution would run it when a user logs in. These are different things.
I've already mentioned MakeMSI. I was able to produce my first msi file in about two days, though I didn't know virtually anything about Windows Installer beforehand. MSI would easily allow you to create the shortcut in startup folder during the installation, without having to bother about the exact location of that folder. Also, chances are that a MSI package will function better on newer Windows versions, where User Account Control is in place.
If you go the other way, make sure to provide ways to cleanly uninstall your program again. You don't want to alienate your users.
subject: how to automatically lunch my app when windows boots?