Setting the default Java character encoding

后端 未结 17 1775
终归单人心
终归单人心 2020-11-21 06:09

How do I properly set the default character encoding used by the JVM (1.5.x) programmatically?

I have read that -Dfile.encoding=whatever used to be the

17条回答
  •  忘掉有多难
    2020-11-21 06:51

    mvn clean install -Dfile.encoding=UTF-8 -Dmaven.repo.local=/path-to-m2
    

    command worked with exec-maven-plugin to resolve following error while configuring a jenkins task.

    Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=512m; support was removed in 8.0
    Error occurred during initialization of VM
    java.nio.charset.IllegalCharsetNameException: "UTF-8"
        at java.nio.charset.Charset.checkName(Charset.java:315)
        at java.nio.charset.Charset.lookup2(Charset.java:484)
        at java.nio.charset.Charset.lookup(Charset.java:464)
        at java.nio.charset.Charset.defaultCharset(Charset.java:609)
        at sun.nio.cs.StreamEncoder.forOutputStreamWriter(StreamEncoder.java:56)
        at java.io.OutputStreamWriter.(OutputStreamWriter.java:111)
        at java.io.PrintStream.(PrintStream.java:104)
        at java.io.PrintStream.(PrintStream.java:151)
        at java.lang.System.newPrintStream(System.java:1148)
        at java.lang.System.initializeSystemClass(System.java:1192)
    

提交回复
热议问题