I have added the jar file.zip by creating a new folder lib and also added it to BuildPath, yet it's not working. At the import statement, it's showing import statement can't be resolved.
Asked
Active
Viewed 411 times
-3

Buhake Sindi
- 87,898
- 29
- 167
- 228

Ayush
- 87
- 1
- 8
-
1No code, no error, no help. – Raptor Sep 14 '15 at 10:43
-
Please provide the log of the errors, so we can understand what is wrong. – Bruno Caceiro Sep 14 '15 at 10:44
-
the error is import statement can't be resolved, even after i have added jar file in the project. – Ayush Sep 14 '15 at 10:56
-
When posting question, take a look at its preview to see possible problems. In case of this question you should notice that your image was not added properly. Also this screenshot only confirms that you have some errors in import section, but we don't know what error it is, which jar you are talking about, and how did you add it. – Pshemo Sep 14 '15 at 10:57
-
well m really sorry for that.. I have added common-lang-2.6-bin as a jar file by creating a lib folder and then added it to the Buildpath. – Ayush Sep 14 '15 at 10:59
-
Add this error message to your question. Also consider posting image of your project structure, which Jar you are referring to, and description letting us reproduce your steps of adding this jar (for now I only see ZIP) – Pshemo Sep 14 '15 at 11:02
-
Possible duplicate: [Eclipse, Java: How to import a library in zip-format?](http://stackoverflow.com/questions/14375810/eclipse-java-how-to-import-a-library-in-zip-format) – Pshemo Sep 14 '15 at 11:21
1 Answers
2
From the screenshot it looks like you have added the ZIP file. Please unzip the file, you shall find a JAR file within it. Add it to the eclipse project and build path.

Dakshinamurthy Karra
- 5,353
- 1
- 17
- 28
-
Actually,Eclipse should be able to use Jars from zip files without problem. – Pshemo Sep 14 '15 at 11:05
-
yes there are two jar files among which one is javadoc. so which one to add? – Ayush Sep 14 '15 at 11:08
-
-
OK, it may depend on structure of ZIP file, but I am sure that there ware cases where I could simply import zip with library without problems. Probably this is not the case then. – Pshemo Sep 14 '15 at 11:14
-
@Pshemo a Java library can be bundled as a JAR or a ZIP (a JAR is also a ZIP file). That is not the case here. The ZIP file contains a JAR file and other information. It is a package. These can't be used as it is within Eclipse. – Dakshinamurthy Karra Sep 14 '15 at 11:16
-
That could be it, or I may had installed some additional plugin to Eclipse which could handle it by searching for things like `[version].jar` or.`[version]-bin.jar` `[version]-src.jar` `[version]-doc.jar`. Don't remember now. Anyway you are right, I tried to add this ZIP and in standard Eclipse can't handle it correctly. – Pshemo Sep 14 '15 at 11:19
-
@Ayush re: KDM's comment: See [Accepting Answers: How does it work?](http://meta.stackexchange.com/a/5235/238021) – Gord Thompson Oct 19 '15 at 16:30