2016-08-24 6 views
2

나는 다음과 같은 코드 조각으로 콘솔에 인쇄 된 경고를 표시하지 않는 방법 :감추는 자바 환경 설정 SYSTEMROOT 경고

Preferences systemRoot = Preferences.systemRoot(); 

다음 (또는 유사한)와 같은 경고는 다음과 같습니다

WARNING: Could not open/create prefs root node Software\JavaSoft\Prefs at root 0x80000002. Windows RegCreateKeyEx(...) returned error code 5. 

주 :
콘솔에 아무 것도 출력하지 않고 not manually create a registry key 또는 running the application as administrator을 출력하면이 경고가 무시됩니다.

private WindowsPreferences(int rootNativeHandle, byte[] rootDirectory) { 
     super(null, ""); 
     int[] result = 
       WindowsRegCreateKeyEx1(rootNativeHandle, rootDirectory); 
     if (result[ERROR_CODE] != ERROR_SUCCESS) { 
      logger().warning("Could not open/create prefs root node " + 
        byteArrayToString(windowsAbsolutePath()) + 
        " at root 0x" + Integer.toHexString(rootNativeHandle()) + 
        ". Windows RegCreateKeyEx(...) returned error code " + 
        result[ERROR_CODE] + "."); 
      isBackingStoreAvailable = false; 
      return; 
     } 
     // Check if a new node 
     newNode = (result[DISPOSITION] == REG_CREATED_NEW_KEY); 
     closeKey(result[NATIVE_HANDLE]); 
    } 

답변

2

겠어요 :)

PlatformLogger platformLogger = PlatformLogger.getLogger("java.util.prefs"); 
platformLogger.setLevel(PlatformLogger.Level.OFF); 

또는 this : 여기

경고에 대한 책임이있는 방법이다.