I'm developing a program that simply monitors a webpage for changes, and plays a sound file. I implemented similar to this answer using SwingUtilities.invokeLater and JOptionPane to make sure sound file is looped continuously.
Program works correctly. Now I would like to place it in crontab (on my Ubuntu Machine) and have it run every 30 minutes. That's where things stop working. I searched for why, and it looks like JOptionPane should be invoked from initial thread (which is the crontab process?). I understand that I just need to prevent main method from ending, but what would be the best approach (DataLine.Drain() ?).