我正在编写一个使用base64编码字符串的类。
我下载了jar文件并以下列方式将其导入我的项目:
右键单击项目库属性 - >单击Add / Jar Folder按钮 - >导航到我想添加的jar文件 - >单击它并单击打开将其上载到库
jar已成功上传,并且在项目库中可见。 但是当我尝试使用它时,netbeans说包org.apache.commons.codec.binary.Base64。 不存在
以下是代码:
package dfqeas.online.actions.application; import org.apache.commons.codec.binary.Base64; //this is the package that netbeans says it does not exist public class encryptbank { public String encryptbank(String words){ String original = words; String Salt = "butternut"; String fullyEncoded; //encoding byte into base 64 byte[] encoded = Base64.encodeBase64(original.getBytes()); byte [] salty = Base64.encodeBase64(Salt.getBytes()); fullyEncoded = new String(encoded) + new String(salty); return fullyEncoded; } }我刚开始学习java和Netbeans,请帮忙。
I am writing a class to encode a string using base64.
I downloaded the jar file and imported it into my project in the following way:
Right click on the project library properties -> Click on the Add/Jar Folder button -> Navigate to the jar file I wish to add -> Click on it and click open to upload it to the library
The jar was successfully uploaded and it is visible in the project library. But when I try to use it, netbeans says the package org.apache.commons.codec.binary.Base64. does not exist
The following is the code:
package dfqeas.online.actions.application; import org.apache.commons.codec.binary.Base64; //this is the package that netbeans says it does not exist public class encryptbank { public String encryptbank(String words){ String original = words; String Salt = "butternut"; String fullyEncoded; //encoding byte into base 64 byte[] encoded = Base64.encodeBase64(original.getBytes()); byte [] salty = Base64.encodeBase64(Salt.getBytes()); fullyEncoded = new String(encoded) + new String(salty); return fullyEncoded; } }I am just starting to learn java and Netbeans, please assit.
最满意答案
尝试重新启动NetBeans 8.2 IDE。
Try restarting the NetBeans 8.2 IDE.
更多推荐
发布评论