1

I am trying a encrypt a plain text using org.apache.commons.codec.binary.Base64. When I call the method org.apache.commons.codec.binary.Base64.encodeBase64String(aByteArray), it gives the following exception

Exception in thread "main" java.lang.NoSuchMethodError: org.apache.commons.codec.binary.Base64.encodeBase64String([B)Ljava/lang/String;

I am using the jar, org-apache-commons-codec.jar. Please help me as I can't understand What is wrong with this.

1
  • Check the API for the relavent version, whether it's has this method with a parameter Commented Nov 27, 2014 at 6:03

1 Answer 1

1

First of all encoding is not encryption. You are only changing representation of your string while encoding, it is easily changed back.

Since you are getting this exception this means that you at least have this jar in your classpath. Open this jar with a suitable zip tool like 7-zip and look at your Manifest.mf file. Your jar version should be greater than 1.4 according to Base64javadoc. Download latest version and replace your older version.

Sign up to request clarification or add additional context in comments.

2 Comments

According to Base64#encodeBase64String javadoc, version should be >= 1.4
@Tobías thanks, I looked at class version, not method version

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.