In the first suggestion, I've noticed that if your
IDE is capturing the output, the beep won't be heard. If run from the command line, the beep is heard from the system speaker.
And I'm pretty sure the second suggestion won't play through the system speaker.
Good Luck.