方法一:
网上大神的回答:
自己写的程序是不建议用这个玩意儿的。。这东西属于“Deprecated and restricted API”。。
而且各种的包现在都有替代品。。
如果是公司的老项目非用不可,可以用eclipse导入maven,properties-> Java Compiler -> Errors/Warnings -> Deprecated and restricted API ->Forbidden reference -> "error" 改成 "warning"
jdk5是可以用这个api的,jdk6之后就不能用了,只能用java,javax开头的api。(据说而已,莫当真)
方法二(我使用的并通过了):
删除
import .Base64;
添加(我使用的):
import .Base64;
或者用java8 .Base64也行
加密解密(替换):
Base64.encodeBase64String
Base64.decodeBase64
方法三(朋友说有用,我没用过)
<plugin>
<groupId></groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<encoding>utf-8</encoding>
<!-- added by .Base64;编译异常
将${}/lib/添加到maven的compiler里面 如果 JAVA_HOME 里面没有,将 jre 里面的 copy
过来 -->
<compilerArguments>
<verbose />
<bootclasspath>${JAVA_HOME}/jre/lib/</bootclasspath>
</compilerArguments>
</configuration>
</plugin>