So i have a task of creating a program which is given absolute path to exe location and time of the day when that exe is supposed to be run and whole program should be running in background and printing a log with time and date info. Java program should be active in background and should run that exe file tomorrow at the same time. I got this code skeleton from another question here
public static void main(String[] args) {
ScheduledExecutorService service = Executors.newSingleThreadScheduledExecutor();
Runnable runnable = new Runnable() {
public void run()
{
// do something;
}
};
// Run it in 8 hours - you would have to calculate how long to wait from "now"
service.schedule(runnable, 8, TimeUnit.HOURS); // You can
}
Okay i've written a program which works. I now need help with running it in background. I have exported it as .jar file since it will be started from cmd (i've created a bat file too, i think app will be started through bat file). Is there any way i can run the program in background and see a small icon in taskbar which would indicate that .jar file is running in background? For example when running on windows i could click "Show hidden icons" on the bottom right of my taskbar and see a small icon which would indicate that script is running?