报错:
����: ����GBK�IJ���ӳ���ַ� * @创建�?
原因:
编译的时候没有添加参数-encoding utf-8
javac -encoding utf-8 xxx.java
但是idea中如何这么设置
其实idea中编译是在maven、gradle中配置编译encoding的。
1.pom.xml
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
2.gradle
在我们的项目配置文件build.gradle中最后添加下面的语句
tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
}