diff -r 5bacc2ced653 jmh-core/src/main/java/org/openjdk/jmh/util/Utils.java --- a/jmh-core/src/main/java/org/openjdk/jmh/util/Utils.java Thu Sep 15 12:48:53 2016 +0200 +++ b/jmh-core/src/main/java/org/openjdk/jmh/util/Utils.java Thu Sep 15 13:34:46 2016 +0200 @@ -248,13 +248,7 @@ return Charset.forName((String) res); } } - } catch (NoSuchFieldException e) { - // fall-through - } catch (IllegalAccessException e) { - // fall-through - } catch (NoSuchMethodException e) { - // fall-through - } catch (InvocationTargetException e) { + } catch (Exception e) { // fall-through } @@ -274,15 +268,21 @@ } } } - } catch (NoSuchFieldException e) { - // fall-through - } catch (IllegalAccessException e) { - // fall-through - } catch (UnsupportedCharsetException e) { + } catch (Exception e) { // fall-through } - // Try 3. Nothing left to do, except for returning a (possibly mismatched) default charset. + // Try 3. Try to poll internal properties. + String prop = System.getProperty("sun.stdout.encoding"); + if (prop != null) { + try { + return Charset.forName(prop); + } catch (Exception e) { + // fall-through + } + } + + // Try 4. Nothing left to do, except for returning a (possibly mismatched) default charset. return Charset.defaultCharset(); }