0

I'm trying to add some external jar files from the Apache Lucene library to Eclipse but every time i add them to the Classpath it keeps saying i need to attach sources. However i have seen multiple tutorials where they've never say anything about adding source files. They just point at the binaries. I have tried adding them as classpath or as a user library but Eclipse refuses to add them as they are. I'm using Apache Lucene 8.8.1 and Eclipse 2021-03. What do i do wrong and i can't add them?

UPDATE: I'm sending some screenshots for better clarification of what i am doing

photo1 after i make a new project and name it i select next and i choose the Libraries tab

photo2

In the Libraries tab i choose the Classpath and then i select the Add External jars option and i select some jar files from the Lucene folder i downloaded

and when I'm trying to select some .class file from some package i keep encountering this message

photo3

  • 1
    I think this may be a misunderstanding. It looks like you already did import those libraries - and now you can refer to them in your code in the usual way (`import` statements). Regarding the "source files missing" problem - that's not really relevant to _using_ these libraries. It's only relevant if you feel the need to _inspect_ their source code (and typically we don't need to do that - we just read the JavaDocs). You can always choose to download the source code for Lucene from its web site, and add it to Eclipse if you want to - but you don't need to! – andrewJames Apr 06 '21 at 22:00
  • 1
    Also, are you familiar with using Maven, Gradle or some other dependency management tool? They can provide a lot of benefits, in terms of managing 3rd party libraries - and the libraries _those_ libraries need - and so on. – andrewJames Apr 06 '21 at 22:03
  • Thank you! Yes I'm familiar with Maven i tried to use it in terms of adding the source files and it worked i could see the .class files. I had the impression that when i add the jar files to the library i should have been able to see the code in there. – Red Tornado Apr 07 '21 at 12:12
  • Some JAR files may include the `.java` source code files bundled with the `.class` files. But others (most?) do not. Usually the source files are provided separately, because they can be much larger than the compiled code, and most people never want to look at them, anyway. – andrewJames Apr 07 '21 at 12:30

0 Answers0