I am using Netbeans and I am trying to use the base64 library, but it gives me "cannot find symbol"
OutputStream b64 = new Base64.OutputStream(os);
First I tried adding it like this
import org.apache.commons.codec.binary.Base64;
Which gives me a package does not exist, so I went to this website and downloaded the jar file. I downloaded for more than one website, but last one was http://www.java2s.com/Code/Jar/o/Downloadorgapachecommonscodecjar.htm
I added the library by right click on libraries, add Jar/Folder and selecting the .jar file that was downloaded. This gives me a package does not exist.
Can someone explain to me why this happens.
Note: My goal is to use java robot to copy a part of the screen and send it as a post request.
Download the jar from Apache: http://commons.apache.org/codec/download_codec.cgi
The desired package and class is available in the jar ie commons-codec-1.7.jar
org.apache.commons.codec.binary.Base64
Add the above Jar from this distribution and let me know, if you still get the issue.
Though I think, to get the output stream, you would want to use org.apache.commons.codec.binary.Base64OutputStream .
I believe you meant to use org.apache.commons.codec.binary.Base64OutputStream
:
OutputStream b64 = new Base64OutputStream(os);
This will require Apache's commons-codec.jar on your classpath.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.