Member Avatar for capt_nemo

I am writing a java netbeans platform application that alerts end users when certain dates, conditions are met, etc... So I want to give the option when the end user installs the program of whether or not the program starts when they log into the computer or not. I also want to give the option in the program itself to change this preference later on, basically a way to toggle if it does or does not start up when they log into the computer. I have found only found two solutions online which are for Micosoft based systems that edit the registry or a plugin that costs 3k. Which neither of these solutions are what I am looking for.

I am just looking for java code that can add or remove a link to the program so it starts up when the user logs into their profile. Basically the same thing as you can do in Microsoft Windows where you can add or remove a link to the program in the Startup folder but will work on any OS. Which I don't know if there is such a solution but I hope there is or something close to it that doesn't alter the registry of the system.

So if anyone knows how I could write this code, where I could find it or what I should be looking for in my searches I would be very thankful.

Java does not offer anything like that functionality (to the best of my knowledge). You could look into batch scripts as a way to support this (your program could call a batch script to schedule/unschedule the program to run at login). This is a terrible way to implement it (the correct way likely involves scheduling with the system or editing the registry). If you're interested in batch scripting this is a great resource. I recommend you start by looking at SCHTASK.

Member Avatar for capt_nemo

dmanw100,

Thank you for the advice and the link. Right now I am looking into if I can somehow can create a shortcut to the program that will go into the startup folder in Windows. But I first have to find out how to create a shortcut with java and place it in that folder. And as of right now, I can't find anything on how to do that either. And I don't even know if this would apply to other OS's because I don't know if they have similar folders. So if anyone has any advice or help in this matter I would be most thankful.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.