原创

java编译乱码解决方案

1、现象

码GBK的不可映射字符
[ERROR] /C:/Users/fengqingyang/Desktop/111/33/FlashGetter/src/main/java/flashGetter/util/ParameterUnitUtil.java:[8,9] 编码GBK的不可映射字符
[ERROR] /C:/Users/fengqingyang/Desktop/111/33/FlashGetter/src/main/java/flashGetter/util/ParameterUnitUtil.java:[8,12]  编码GBK的不可映射字符
[ERROR] /C:/Users/fengqingyang/Desktop/111/33/FlashGetter/src/main/java/flashGetter/util/ParameterUnitUtil.java:[8,16]  编码GBK的不可映射字符
[ERROR] /C:/Users/fengqingyang/Desktop/111/33/FlashGetter/src/main/java/flashGetter/view/model/DownloadedTableModel.java:[16,9] 编码GBK的不可映射字符
[ERROR] /C:/Users/fengqingyang/Desktop/111/33/FlashGetter/src/main/java/flashGetter/view/model/DownloadedTableModel.java:[16,12] 编码GBK的不可映射字符
[ERROR] /C:/Users/fengqingyang/Desktop/111/33/FlashGetter/src/main/java/flashGetter/view/model/DownloadedTableModel.java:[16,15] 编码GBK的不可映射字符
[ERROR] /C:/Users/fengqingyang/Desktop/111/33/FlashGetter/src/main/java/flashGetter/view/model/DownloadedTableModel.java:[65,31] -source 1.5 中不支持 lambda 表达式
[ERROR]   (请使用 -source 8 或更高版本以启用 lambda 表达式)
[ERROR] /C:/Users/fengqingyang/Desktop/111/33/FlashGetter/src/main/java/flashGetter/view/sidebar/SideBarPlatter.java:[16,9] 编码GBK的不可映射字符
[ERROR] /C:/Users/fengqingyang/Desktop/111/33/FlashGetter/src/main/java/flashGetter/view/sidebar/SideBarPlatter.java:[16,12] 编码GBK的不可映射字符
[ERROR] /C:/Users/fengqingyang/Desktop/111/33/FlashGetter/src/main/java/flashGetter/view/sidebar/SideBarPlatter.java:[16,16] 编码GBK的不可映射字符
[ERROR] /C:/Users/fengqingyang/Desktop/111/33/FlashGetter/src/main/java/flashGetter/view/tasktable/TableHeadRenderer.java:[16,9] 编码GBK的不可映射字符
[ERROR] /C:/Users/fengqingyang/Desktop/111/33/FlashGetter/src/main/java/flashGetter/view/tasktable/TableHeadRenderer.java:[16,12] 编码GBK的不可映射字符
[ERROR] /C:/Users/fengqingyang/Desktop/111/33/FlashGetter/src/main/java/flashGetter/view/tasktable/TableHeadRenderer.java:[16,16] 编码GBK的不可映射字符
[ERROR] /C:/Users/fengqingyang/Deskto

2、解决办法

<properties>
    <java.version>1.8</java.version>
    <maven.compiler.encoding>UTF-8</maven.compiler.encoding>
</properties>

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.3.2</version>
            <configuration>
                <source>1.8</source>
                <target>1.8</target>
                <encoding>utf-8</encoding>
            </configuration>
        </plugin>
    </plugins>
</build>

3、根因

未锁定项目的编译编码字符集

正文到此结束
本文目录