private static void appendEncoding( SimpleJavaParameters javaParameters, GeneralCommandLine commandLine, ParametersList parametersList) { // Value of file.encoding and charset of GeneralCommandLine should be in sync in order process's // input and output be correctly handled. String encoding = parametersList.getPropertyValue("file.encoding"); if (encoding == null) { Charset charset = javaParameters.getCharset(); if (charset == null) charset = EncodingManager.getInstance().getDefaultCharset(); commandLine.addParameter("-Dfile.encoding=" + charset.name()); commandLine.withCharset(charset); } else { try { Charset charset = Charset.forName(encoding); commandLine.withCharset(charset); } catch (UnsupportedCharsetException ignore) { } catch (IllegalCharsetNameException ignore) { } } }