我正在尝试编译新的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()是返回解码器实例的静态方法,您无需使用new创建它。
关于java - Java 8,Base64.Decoder编译,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/28799006/