Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a very weird problem with a Java GUI that I've built at work. It is so weird I don't even know where to start to look for help!!

We have a standalone system at an offsite location consisting of a Windows PC, running XP, and a SuSE Linux machine. I built a Java GUI that runs some bash scripts on the Linux machine. The GUI is started from the Windows machine because the user is not a Linux person. The GUI was built to replace scripts that presented the user with command line prompts for providing inputs to the main processing scripts.

The user clicks an icon on the windows desktop which runs a DOS batch (*.bat) file. The batch file uses plink, with a stored PuTTY session, to connect to the Linux machine and to execute a "java -jar XXX.jar" command to start the GUI. The GUI displays on the Windows PC due to Cygwin/X X Server running on the windows PC.

Okay. Now for the weirdness. If I leave the GUI in the location where it initially pops up, everything is fine. If I move the GUI, then the pulldown menus (dropdown combo boxes and menubar pulldowns) no longer work properly. And ONLY the pulldown menus. Everything else works fine (pushbuttons, text fields, ...). If I move the GUI back to its original location, everything works fine. If I click, hold and drag the mouse cursor over to where the GUI initially popped up (leaving the GUI where I moved it) the pulldown menus work properly.

At first I thought I had a problem with the way I initialized the pull down menus but I'm not so sure anymore. I'm wondering if there is something weird going on with the windows <-> putty <-> linux or the Xwin setups.

Contributing to not being able to solve this is that I cannot replicate this behavior at work. Unfortunately we don't have an exact replica of the offsite system; I'm testing/building this GUI on a XP to Debian Linux machine.

As anybody seen anything like this? Any suggestion as to what might be going on here?

Thanks times a billion

Bill

share|improve this question

2 Answers 2

up vote 0 down vote accepted

I don't think running Java through X redirection is a good idea.

Why don't you put the Java program on the Windows PC and use it to launch plink and run the command? If you have the source code of the Java program, it should be trivial to add a class that wraps and replaces Runtime.getRuntime().exec() and put plink in front of the command line. Then maybe you can work on the class a bit for it to use one plink session for everything. Then you can also make another class with the same interface but does not add the plink so your Java program can run on both Windows and Linux.

share|improve this answer
    
Thanks ... I didn't think of that-using plink to run the scripts instead of the GUI :) Just curious, why is running Java through X redirection a bad idea? –  Bill Doss Jan 27 '12 at 14:54
    
I reworked my source code to run on windows and use plink to execute the commands on the linux machine. Because this works, I will consider this question "solved". Thanks!!!!!!!! –  Bill Doss Feb 8 '12 at 0:36
    
(Sorry, somehow the notification for your first comment is ignored.) It's not a good idea because it's unnecessary overhead and is really slow and unstable. –  billc.cn Feb 8 '12 at 10:33

It might have something to do with hardware acceleration of Java 2D, Java's graphics system.

Try turning off any hardware acceleration by adding the following command line option of the Java process:

-Dsun.java2d.d3d=false

There is also a full reference to Java 2D settings here. Turning Direct 3D off will make the UI slower, but for simple UIs with just menus and no animations it shouldn't matter.

share|improve this answer
    
Thanks. I will try that next when we go back to the offsite location. –  Bill Doss Jan 27 '12 at 14:52

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.