0

我的 JInput 代码工作正常,它只是在每次程序启动时将这些警告打印到控制台。我需要压制他们。

2017 年 11 月 29 日上午 8:59:55 net.java.games.input.DefaultControllerEnvironment getControllers 警告:发现未知 Windows 版本:Windows 10 2017 年 11 月 29 日上午 8:59:55 net.java.games.input.DefaultControllerEnvironment getControllers 警告: 尝试使用默认的 windows 插件。

编辑:我找到了一种方法,但这有点小技巧:System.err.close();有没有办法让我暂时禁用System.err

4

1 回答 1

0

解决方案是使用System.setErr()

    PrintStream error=System.err;
    System.setErr(new PrintStream(new OutputStream(){
        public void write(int a){}
    }));
    controllers=ControllerEnvironment.getDefaultEnvironment().getControllers();
    System.setErr(error);
于 2017-12-09T02:39:28.833 回答