I just want to know why we can't add jar files in zip format in eclipse.I tried to add external jar files as zip just to know weather it is correct or not. But it gives error.But when I google it some articles say we can add in zip format.Can anyone explain me this.
-
1And what error might that be? Usually they are for a reason and explain things, not just “error” – Sami Kuhmonen Jan 30 '19 at 08:10
-
It gives error as "The import org.springframework cannot be resolved" – Lasa Jan 30 '19 at 08:18
-
What zip are you trying to add? Can you send a link to some online resource? When something is packaged as a zip, it's probably not meant to be added as a library in the usual way. – NeplatnyUdaj Jan 30 '19 at 08:31
-
a .jar file IS a .zip file. are you asking if you can add a zip with jars, or compiled java classes in a zip? or javadocs in a zip? – JoSSte Jan 30 '19 at 08:33
2 Answers
A text file with a .java
extension is a Java Source File, but it is just a text file, so why does it have to have the .java
extension? Because a text file with any other extension is not considered by most tools to be a Java Source File.
A zip file with a .jar
extension is a Java Archive File, containing compiled Java Class Files (and more), but it is just a zip file, so why does it have to have the .jar
extension? Because a zip file with any other extension is not considered by most tools to be a Java Archive File.
File extension matters for the determination of the file type.

- 154,647
- 11
- 152
- 247
Did some more research and found this:
How to add external library properly in Eclipse?
I then followed the steps:
- Extracted all google api content to one folder named lib.
- Created a New User Librarby Window -> Preference -> Java -> Build Path -> New -> Name your library -> left the System Library unchecked -> Add External Jars -> manually added the needed jars.
- Right click on project folder -> Build Path -> Configure Build Path -> Libraries -> Add Library -> User Library -> checked the created user library.
In conclusion: Don't ever import the library as a zip or you will have a long headache.
Hope this helps someone else.
In case of some error showing up, like missing files belonging to the user library, cleaning the project may prove to be a solution. However, refreshing the project worked just fine for me. Try pressing F5 or right clicking on your project folder and select refresh.

- 261
- 1
- 11