Search code examples
javawindowsswingdesktopstartup

How can I Start My application on Start up of Windows in java


I have My Swing Application. and What I want to do is Lunch that Application when Windows Start up. so how can I do that Can i have suggestion? and application is Desktop application. and What to do for MAC system is there any way for MAC system for do this same?


Solution

  • On Windows

    You could simply place an executable item in the users Startup folder, see Run a program automatically when Windows starts for more details.

    This will require to supply a short-cut (which can launch the jar using java.exe) or a batch file or a executable wrapper, like exe4j or launch4j for example.

    On Mac

    There are a few places to look for startup items:

    Items can launch upon startup from the following locations:

    System Preferences > Accounts > yourusername > Login Items
    (Lion users: System Preferences > Users & Groups > yourusername > Login Items)

    /Library/LaunchAgents/ and ~/Library/LaunchAgents/
    (Lion users: In Finder, click Go > Go to Folder > then enter the path)

    /Library/StartupItems/
    (Lion users: In Finder, click Go > Go to Folder > then enter the path)

    This assumes that the application has been bundled as an application bundle. See Packaging a Java App for Distribution on a Mac and Java Application Bundler for more details.

    There may be additional requirements in the pinfo files that I've not highlighted, but these are the basics. This is not an area I have experience in, but something I've done a little bit of research into

    Take a look at:

    For more details