Question: I have a cron task that runs periodically. This task depends on a condition to be valid in order to complete its processing. In case it matters this condition is just a SELECT for specific records in the database. If the condition is not satisfied (i.e the SELECT does not return the result set expected) then the script exits immediately.  

This is bad as the condition would be valid soon enough (don't know how soon but it will be valid due to the run of another script).  

So I would like somehow to make the script more robust. I thought of 2 solutions: 

1. Put a `while` loop and `sleep` constantly until the condition is
valid. This should work but it has the downside that once the script
is in the loop, it is out of control. So I though to additionally
after waking up to check is a specific file exists. If it does it
"understands" that the user wants to "force" stop it.
2. Once the script figures out that the condition is not valid *yet* it
appends a script in crontab and stops. That seconds script
continually polls for the condition and if the condition is valid
then restart the first script to restart its processing. This solution to me it seems to work but I am not sure if it is a good solution. E.g. perhaps programatically modifying the crontab is a bad idea?

Anyway, I thought that perhaps this problem is common and could have a standard solution, much better than the 2 I came up with. Does anyone have a better proposal? Which from my ideas would be best? I am not very experienced with cron tasks so there could be things/problems I could be overseeing.

Answer: 
You can simply use `JOptionPane` for this. Just call it like so:

```
JOptionPane.showMessageDialog(this, "Name is missing");

```

It will display the message in a dialog box and wait for OK.
To show a popup messages from any kind you can use the class JOptionPane and their static methods. in your case `JOptionPane.showMessageDialog(null, "Name is missing");` should do the thing.