Fix menu-related handling (aka hacks) in the Java toolkit script