1

I have downloaded common.codec binary jar file. Now I want to use the class org.apache.commons.codec.binary.Base64. But this folder contains four jar files namely common.codec-1.7.jar,commons-codec-1.7-javadoc.jar, commons-codec-1.7-sources,commons-codec-1.7-tests,commons-codec-1a.7-test-sources. Now which path should I mention in class path? And I tried with all the jar file paths and imported in my program but failed. Please tell me where to place this downloaded jar file and how to use it in my code.

Baby Groot
  • 4,637
  • 39
  • 52
  • 71
user1331502
  • 7
  • 1
  • 3
  • 1
    Are you using an IDE like Eclipse or IntelliJ? In either case, you have to place the commons-codec-1.7.jar on your classpath. It should be available per project configuration. OTOH, if you're just compiling files directly from CLI, you can put the jar on classpath like: `javac -cp YourClassFile.java` – S.R.I Apr 06 '13 at 06:44

1 Answers1

5

You can use common.codec-1.7.jar if you are using an IDE like

Eclipse:

1.Right-click your Project.

2.Select Properties.

3.On the left-hand side click java build path.

4.Under Compile tab - click Add External Jars button.

Netbeans :

1.Right-click your Project.

2.Select Properties.

3.On the left-hand side click Libraries.

4.Under Compile tab - click Add Jar/Folder button.

or if you directly compiling classes without IDE you can do as @S.R.I mentioned in comment.

Lakshmi
  • 2,204
  • 3
  • 29
  • 49
  • Am not using any IDE..I took a folder on desktop and placed jar folder and my code file in that folder..i gave command like javac -cp jarfile/commons-codec-1.7-bin/commons-codec-1.7.jar insertdata.java. But still its shows me org.apache.commons.codec.binary does not exist – user1331502 Apr 06 '13 at 11:54
  • I have not personally done coding without IDE but you can try reading this http://dev.wavemaker.com/forums/?q=node/4751 and http://stackoverflow.com/q/6526883/2006839 and http://www.linuxquestions.org/questions/programming-9/javac-compiling-error-mising-package-669775/ check whether your jar contains the class org.apache.commons.codec.binary – Lakshmi Apr 08 '13 at 06:02