Package com.sun.org.apache.xml.internal.security.utils.Base64 does not exist

I use NetBeans 7.0.1 and JDK 1.6 Update 24 and when importing the com.sun.org.apache.xml.internal.security.utils.Base64 package to encode the password hash:

 u.setPassword(Base64.encode(digest(password))); 

However, when compiling, I get the following error:

 (omitted)\RegistrationController.java:8: package com.sun.org.apache.xml.internal.security.utils does not exist import com.sun.org.apache.xml.internal.security.utils.Base64; (omitted)\RegistrationController.java:94: cannot find symbol symbol : variable Base64 location: class RegistrationController u.setPassword(Base64.encode(digest(password))); 2 errors 

I read a few other questions regarding the same problem, but they all relate to packages that are not part of the JDK, whereas this ( rt.jar ). Code Assists works on the type and extends the jar, and in fact, both the source code and the binary are present.

I tried to clean the project, rebuild it, copy the source files to a completely new Enterprise project and run NetBeans as an administrator, but all to no avail. Any clue on how to solve this is greatly appreciated!

Thanks!

+8
java netbeans
source share
2 answers

com.sun. * classes are not part of the Java API, and you should not rely on them. I would suggest using Apache Commons Codec instead of Base64 encoding.

+20
source share

Using org.apache.commons.codec.binary.Base64 use a special method (e.g. Base64.encodeBase64String() for example) to replace Base64.encode

+2
source share

All Articles