Java8、Base64.Decoder编译

Java 8, Base64.Decoder compilation

我正在尝试编译新的 Java Base64 API (docs),因为旧的 BASE64Decoder 已被贬低,但我不能明白为什么我会出错。

这是我的代码:

Base64.Decoder b64 = new Base64.getDecoder();

我安装了最新的 Java JDK 版本和 maven。

Maven 输出:

Caused by: org.apache.maven.plugin.compiler.CompilationFailureException:      
Compilation failure
pl/kris14an/vinylrepo/ImageDecoder.java:[14,44] cannot find symbol
    symbol:   class getDecoder
    location: class java.util.Base64

Apache Maven 3.2.5

Java 版本:1.8.0_31,供应商:Oracle Corporation

您不需要在这一行中添加新内容:Base64.Decoder b64 = new Base64.getDecoder();

Base64.getDecoder()是returns解码器实例的静态方法,不需要new.