Caused by: java.lang.IllegalArgumentException

Caused by: java.lang.IllegalArgumentException 是因为jdk较高而项目需要的是低版本的问题

1.将idea或idea里的语言级别调到适合自己项目的版本比如安装的是1.8 项目需要1.6的环境 这样之后本地运行应该就没问题了(只用过idea eclipse还没试) 在没加下面这步之前 不要用maven打包 这样idea会用你打好的包 这样也会报错。 

2.如果要解决服务器上报这样错 在pom文件里加以下: 这样过后即便是打了包也没问题

pom文件里加

<build>
<finalName>xxxxxx</finalName>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>

<configuration>
<!-- 以下是修改我们编译时的jdk版本 即使是高版本jdk 设置之后打包编译会根据你的设置的版本去执行 -->
<!-- use the Java 6 language features -->
<source>1.6</source>
<!-- want the compiled classes to be compatible with JVM 1.6 -->
<target>1.6</target>
<!-- The -encoding argument for the Java compiler. -->
<encoding>UTF8</encoding>
</configuration>

   </plugin>

</plugins>
</build>

猜你喜欢

转载自www.cnblogs.com/AmbitiousMice/p/9288190.html
今日推荐