Recall that I am writing Java plugins that extend KeyListener.
I had a plugin (call it "A") that ran perfectly on my Mac laptop, and a Windows laptop, but often failed on a different laptop. Then we found that it failed on TWO mac laptops from the same family. A helpful person here tested it on yet another laptop, and it worked perfectly. The code looks perfect. I solved the problem by loaning the Windows laptop to my client, and he has been happy. In the meantime, I started to write a variant on this laptop (a few differences setting things up - but otherwise the identical code). I did this on my brand new Mac laptop...which meant establishing a new environment, etc. Well...the new plugin (call it "B") fails on the new laptop in the same way (keyPressed() is never called). I tried ripping out the wait/notify technique of communicating the keypress and returned to busy waiting for a shared boolean to flip. No joy. So...I copied the .jar file for "A" from my old(er) laptop (where it works perfectly) to the new laptop. It fails! So, I can replicate the problem! But, I have no clue. I have removed all the suspect "IJ.log()" calls that some people pointed out as being problematic inside things like keyPressed. Nothing works. So..."A", built on the old laptop, works on the old laptop, but fails on the new laptop (and my client's two laptops). "B", built on the new laptop, does not work on the new laptop. So...let's copy B.jar to the old laptop. Nope - fails there, too. What's different? Well, on the old laptop I compile everything with source=1.6, using: %java -version java version "1.8.0_241" Java(TM) SE Runtime Environment (build 1.8.0_241-b07) Java HotSpot(TM) 64-Bit Server VM (build 25.241-b07, mixed mode) On the new laptop, I compile with source=1.8, because 6 is not supported, using: %java -version openjdk version "14" 2020-03-17 OpenJDK Runtime Environment AdoptOpenJKD (build 14+36) OpenJDK 64-Bit Server VM AdoptOpenJDK (build 14+36, mixed mode, sharing) The old laptop is running Catalina 10.15.4 on a MacBook Pro(15-inch, 2017), Processor 3.1GHz Quad-Core Intel Core i7 The new laptop is running Catalina 10.15.4 on a MacBook Pro(16-inch, 2019), Processor 2.4 GHz Intel Core i9 Sorry - I don't know the specs on the client's two macs. Next step will be to build B in the old environment, to see what happens. I'm going to guess that it will work on the old laptop and fail on the new (because that's what A does, and it's functionally equivalent). Is it the Java runtime environment? Is it a difference in 1.6 vs 1.8? More pressing - is there another (however clunky) way to get keypresses made in an Image Window? Is there anything I can have my code interrogate to be sure that the KeyListener is properly registered. Recall that the effect is that keyPressed() is never called. This could be because registering the KeyListener failed for some reason. To make it more interesting - the failure on the client mac was intermittent - sometimes it worked, and sometimes it didn't. Not working seemed to be "sticky". On my new machine, it has never worked - but I have only tried a few times, so it *might* be intermittent there, too. I'm stumped. Help, please! -- Kenneth Sloan [hidden email] Vision is the art of seeing what is invisible to others. -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Update: I moved the source for "B" to the old laptop, changed all the "1.8" to "1.6" in the ant build.xml file, and built it.
It works perfectly on the old laptop. Recall that the very similar "A" built on the old laptop FAILS on the new laptop. When "B" is built on the new laptop (different compiler, different level) it fails on both laptops. When "B" is built on the old laptop, it works on the old laptop (and presumably, but I didn't test) will fail on the new laptop. Again - these are all 100% (small sample) observations on my new laptop - there are intermittent failures on different laptops (unknown Java environment). It smells like a 1.8 vs 1.6 problem - but I'm ignorant of the differences. Any clues? As before - I'm happy to send source code to anyone for independent testing. For now, I *might* be able to get away with developing on the old environment and hoping that no clients will have problematic run time environments, but that feels like sticking my head in the sand. Otherwise - tomorrow I will write the smallest possible plugin that uses KeyListener and see if that fails in the new environment. But, the current source code is pretty small and quite straightforward. -- Kenneth Sloan [hidden email] Vision is the art of seeing what is invisible to others. -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
On Mon, April 6, 2020 11:06 pm, Kenneth Sloan wrote:
... > Otherwise - tomorrow I will write the smallest possible plugin that uses > KeyListener and see if that fails in the new environment. But, the > current source code is pretty small and quite straightforward. ... hmm... In desperation on Linux I turn to strace or gdb. strace let's you see if/who is interacting with the OS and at least answers the question if there is a sniffer/snagger. gdb let's you see if certain routines are being called and where along the chain they go. Note: ImageJ Edit>Options>Compiler>'-g' Doing a minuscule search it seems as though there are options for your systems: https://en.wikipedia.org/wiki/Strace # Similar tools https://stackoverflow.com/questions/5096707/how-is-gdb-used-to-debug-java-programs first answer... enjoy, Fred -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Free forum by Nabble | Edit this page |