kris14an
kris14an

Reputation: 751

Java 8, Base64.Decoder compilation

I'm trying to compile new Java Base64 API (docs), because old BASE64Decoder is depracated, but i can't understand why i'm getting error.

That's my code:

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

I installed latest Java JDK version, and maven.

Maven output:

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 version: 1.8.0_31, vendor: Oracle Corporation

Upvotes: 1

Views: 2334

Answers (1)

Marko Živanović
Marko Živanović

Reputation: 906

You don't need new in this line: Base64.Decoder b64 = new Base64.getDecoder();

Base64.getDecoder() is static method that returns decoder instance, you don't need to create it with new.

Upvotes: 4

Related Questions