Scaling on High-DPI Monitor is Incorrect

I wrote a sketch using Processing 2 but rather than using the Processing IDE, I used Eclipse. I now want to export the sketch as a jar file, but I am having an annoying issue when trying to run the resulting jar on a display with a High-DPI monitor. For some reason, running the sketch outside of Eclipse results in the window being scaled up, but the size of the sketch itself being retained (see screenshot).

In the screenshot depicted, the blue square makes up the content of the actual sketch while the black portion is unused space that is not there. Additionally, the mouse coordinates are not correct as a result. It is worth noting that this undesired scaling up does not occur when I run the sketch in Eclipse, nor does it happen if I launch the jar via the command line by making use of “java -jar .jar”. How can I fix this?

I’m not sure, but this sounds familiar – this might be related to: