Take the 2-minute tour ×

I am using exact code from here:

to generate a signature for my application. However, one line of code is not recognized in Eclipse

result = Encoding.EncodeBase64(rawHmac);

Eclipse is saying it does not recognize the "Encoding" class. This is the exact error:

The method EncodeBase64(byte[]) is undefined for the type Encoding

I've tried importing the following 3 things:


However all three of these then tell me they don't recognize the 'EncodeBase64' function. Does anybody know what import im supposed to use for the code linked above?

share|improve this question
The exact error message is The method EncodeBase64(byte[]) is undefined for the type Encoding –  Katherine Perotta Oct 2 '12 at 21:02
add comment

2 Answers

There is Base64 encoding/decoding support in standard Java: javax.xml.bind.DataTypeConverter. That would be a zero overhead choice.

share|improve this answer
add comment

Note that no proficient Java developer will use an uppercase letter for the start of a method, so if you did not make a typo, you cannot expect to find Encoding.EncodeBase64 in any standard library. You are better off using another Base 64 encoder/decoder, such as the one found in the Apache Commons Codec - which seems to have the best API available to me.

share|improve this answer
add comment

Your Answer


