1 How to prepare an Ubuntu machine for GTK-2-less test run. 2 3 The test DemandGTK2.sh should work well without GTK-2 switching to version 3 4 if there's no GTK-2 library available. 5 At the moment, it's not easy to find a system with GTK-3 and without GTK-2: 6 many programs still depend on version 2. 7 We can, however, rename GTK-2 library for a single test run and then restore 8 it back. 9 10 (1) Find GTK2 library: run 11 /sbin/ldconfig -v 2>/dev/null | grep libgtk-x11-2 12 13 It will output one or two lines like 14 libgtk-x11-2.0.so.0 -> libgtk-x11-2.0.so.0.2400.23 15 Search for the target of that symlink for instance with locate: 16 locate libgtk-x11-2.0.so.0.2400.23 17 Finally, you'll find the libraries. On my current machine they are 18 /usr/lib/i386-linux-gnu/libgtk-x11-2.0.so.0.2400.23 19 /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0.2400.23 20 21 I'm running 64-bit JDK and need to tamper with x86_64 copy only. 22 23 (2) Find running programs depending on this library. They probably would crash 24 if you rename it. Stop them for this test run. 25 That said, I'm afraid it would be impossible to do on a system older than Ubuntu 16.04. 26 On my Ubuntu 16.04 I have only hud-service using this library, and that's OK, it will restart 27 after a crash, if any. 28 To find these programs, run 29 lsof /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0.2400.23 30 31 (3) Now, 32 sudo mv /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0.2400.23 /usr/lib/x86_64-linux-gnu/bak.libgtk-x11-2.0.so.0.2400.23 33 jtreg DemandGTK2.sh 34 sudo mv /usr/lib/x86_64-linux-gnu/bak.libgtk-x11-2.0.so.0.2400.23 /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0.2400.23 35 36 Needless to say, you should substitute your own library path and however you run jtreg. 37