DEV Community

rafaone
rafaone

Posted on

Java8 + JavaFx updates issues

Java8 with JavaFX: A Challenging Task to Update a Legacy System 200 Updates Behind

A legacy system, running on a dedicated Linux totem-like device with the "twm" minimal window manager, and only the main application running in X, presented a significant challenge. The system, using Java8 with JavaFX, was 200 updates behind, necessitating a major update from 8.0u232 to 8.0u442.

Image description

Upon upgrading to the latest currently version 8u442, the same ".jar" binary exhibited window positioning issues. Despite setX(0) and setY(0) being set in the code, the window no longer appeared at the top-left corner. Since the window manager remained the same, the issue was clearly attributed to Java.

To accommodate the need for the latest Java version, a workaround was devised to move the application window via a script. This approach leveraged the window ID, reminiscent of techniques used in keyloggers that monitor application title bars.

xdotool proved to be an invaluable tool for simulating X input.

Image description

AI struggled to provide a simple script for this task. It became apparent that for complex tasks, breaking them into smaller problems, manageable problems was more effective for AI assistance. However, the ultimate solution was found in the documentation. The AI's suggestion to retrieve the window ID by application title worked for the initial window, but became impractical for subsequent forms with varying titles. The getwindowfocus option in xdotool provided the necessary solution.

By running the script every 2 seconds, the focused window was moved to X(0) and Y(0), effectively centering it (assuming full-screen windows).

This type of solution highlights the limitations of AI in handling complex, macro-level problems. While AI can be helpful, it often lacks the ability to grasp the bigger picture.

Top comments (0)

Great read:

Is it Time to go Back to the Monolith?

History repeats itself. Everything old is new again and I’ve been around long enough to see ideas discarded, rediscovered and return triumphantly to overtake the fad. In recent years SQL has made a tremendous comeback from the dead. We love relational databases all over again. I think the Monolith will have its space odyssey moment again. Microservices and serverless are trends pushed by the cloud vendors, designed to sell us more cloud computing resources.

Microservices make very little sense financially for most use cases. Yes, they can ramp down. But when they scale up, they pay the costs in dividends. The increased observability costs alone line the pockets of the “big cloud” vendors.

👋 Kindness is contagious

Engage with a wealth of insights in this thoughtful article, valued within the supportive DEV Community. Coders of every background are welcome to join in and add to our collective wisdom.

A sincere "thank you" often brightens someone’s day. Share your gratitude in the comments below!

On DEV, the act of sharing knowledge eases our journey and fortifies our community ties. Found value in this? A quick thank you to the author can make a significant impact.

Okay