Assuming you deploy your Java Applications on Windows, you can use this WIN32API functions:
// turn off monitor
SendMessage(HWND_BROADCAST, WM_SYSCOMMAND, SC_MONITORPOWER, (LPARAM) 2);
// turn on monitor
SendMessage(HWND_BROADCAST, WM_SYSCOMMAND, SC_MONITORPOWER, (LPARAM) -1);
Then you write a little C-JNI wrapper to functions that call the mentioned SendMessage
and use the little wrapper to turn off the monitor from Java.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…