簡體   English   中英

禁止JInput警告

[英]Suppress JInput Warnings

我的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插件。

編輯:我找到了一種方法來做,但這有點hack: System.err.close(); 我有辦法暫時禁用System.err嗎?

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

    PrintStream error=System.err;
    System.setErr(new PrintStream(new OutputStream(){
        public void write(int a){}
    }));
    controllers=ControllerEnvironment.getDefaultEnvironment().getControllers();
    System.setErr(error);

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM