0

Have this import in my proyecto import com.sun.org.apache.xml.internal.security.utils.Base64; but when i go to build and clean with netbeans it give me error,

error: package com.sun.org.apache.xml.internal.security.utils does not exist Code where Base64 needed: String encryptedStr = Base64.encode(encrypted, Base64.BASE64DEFAULTLENGTH);

How can i solve this, need i add a external jar to the proyect ?

Thx for all

peti446
  • 330
  • 1
  • 4
  • 12
  • 1
    possible duplicate of [Package com.sun.org.apache.xml.internal.security.utils.Base64 does not exist](http://stackoverflow.com/questions/7111577/package-com-sun-org-apache-xml-internal-security-utils-base64-does-not-exist) – RealSkeptic Feb 04 '15 at 18:31
  • Solution given there don't work for me. – peti446 Feb 04 '15 at 18:38
  • 1
    Did you look at the comments to the solution? There is an official Base64 class in Java8. Use that. – RealSkeptic Feb 04 '15 at 18:41
  • But i'm actually using 1.7, but ok will try with java 8 – peti446 Feb 04 '15 at 18:58

1 Answers1

0

For an extra jar read this thread

or You can use

javax.xml.bind.DatatypeConverter methods accordingly
DatatypeConverter.printBase64Binary() and DatatypeConverter.parseBase64Binary
Community
  • 1
  • 1
iamiddy
  • 3,015
  • 3
  • 30
  • 33
  • i finally downloaded org.apache.commons.codec.binary.Base64; and its work but i need to to some changes to get it work but now its work – peti446 Feb 04 '15 at 19:36