You shouldn't be trying to display anything to the user from Java. In Mendix apps, the browser front-end runs in a browser and executes JavaScript code. The back-end server runs in a JVM and is capable of executing Java code.
So, your example is trying to display a pop-up on the web server in the Mendix cloud, instead of in a user's browser.
You should be using Mendix pages and microflows to display feedback to users.
Did you try to trigger the pop-up with addTextMessageFeedback as described in this topic?