我的程序中有 getRuntime().exec() 调用;但是,其中两个不起作用:
public static final ROTCW = "xrandr -o left"
public static final CALCW1 = "xinput --set-prop 11 \"Evdev Axis Inversion\" 0 1"
public static final CALCW2 = "xinput --set-prop 11 \"Evdev Axes Swap\" 1";
public void actionPerformed(ActionEvent e)
{
try {
Runtime.getRuntime().exec(ROTCW);
Runtime.getRuntime().exec(CALCW1);
Runtime.getRuntime().exec(CALCW2);}
catch (IOException ioe){ ioe.printStackTrace();}
}});
ROTCW 确实有效(屏幕顺时针旋转),但它不校准(CALCW)。在与我启动程序的终端选项卡相同的终端选项卡中手动键入 CALCW不起作用,但将其键入新的终端选项卡/窗口确实有效。
为什么会发生这种情况,以及如何解决它?