Java version of Dynamic-MOTD