简体   繁体   中英

Suppress JInput Warnings

My JInput code works fine, it just prints these warnings to the console every time the program starts. I need to suppress them.

Nov 29, 2017 8:59:55 AM net.java.games.input.DefaultControllerEnvironment getControllers WARNING: Found unknown Windows version: Windows 10 Nov 29, 2017 8:59:55 AM net.java.games.input.DefaultControllerEnvironment getControllers WARNING: Attempting to use default windows plug-in.

EDIT: I found a way to do it, but it's a bit of a hack: System.err.close(); Is there a way for me to temporarily disable System.err ?

The solution is to use System.setErr() :

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM