Unable to use apache commons ftp import

Unable to use apache commons ftp import



I've been trying to create my own FTP client written in Java. I wrote one ages ago in C#, so I would like to try in Java. I created a user library for apache commons and added it to my build path. The problem is that when typing the import statement it doesn't recognise it. It finds a error at org, saying "import org cannot be resolved".


import org.apache.commons.net.ftp.FTP;
import org.apache.commons.net.ftp.FTPClient;



I am using eclipse as my IDE.



Here two screenshots showing the error:



enter image description here



enter image description here





Please show the added library in Project > Properties: Java Build Path, tab Libraries (instead of adding it as user library, you could have added it also directly as JAR or external library, but it should work either way).
– howlger
Aug 28 at 21:35





I have the JRE library and I added the apache-commons to my project library
– Governor Keagan
Aug 29 at 22:15





Please add a screenshot of that dialog to your question. I guess, there are errors in the Problems view. If there are build errors, please add also the error messages to your question.
– howlger
Aug 30 at 7:10





I can't post images yet. How do you want me to link the screenshots? (Which site?)
– Governor Keagan
Aug 31 at 0:09





You can copy the error message(s) as text. If you add a link to the screenshot, I will embed it as an image for you (I was not aware of this limitation).
– howlger
Aug 31 at 1:23




1 Answer
1



The following line is probably missing in the module-info.java file:


module-info.java


requires org.apache.commons.lang3;



and in the Java Build Path the Classpath contains the broken (as you can see from the red error mark) item apache-commons-lang by mistake: select it and click Remove.


apache-commons-lang



Since Java 9, modules can be specified, but this requires a correct module-info.java file and the libraries must be added to the Modulepath instead of to the Classpath. Without the module-info.java file it would be easier. Therefore, perhaps the simpler solution would be to delete module-info.java file.


module-info.java


module-info.java


module-info.java



In addition, the *-source.jar should be as Source attachment a child of the main JAR and the *-javadoc.jar is not needed with the source (but if, then as Javadoc location child of the main JAR).


*-source.jar


*-javadoc.jar



Hint: If an error or a warning is shown with a light bulb, go to the line and click Ctrl+1 and Eclipse will suggest solutions for that problem.



Thanks for contributing an answer to Stack Overflow!



But avoid



To learn more, see our tips on writing great answers.



Some of your past answers have not been well-received, and you're in danger of being blocked from answering.



Please pay close attention to the following guidance:



But avoid



To learn more, see our tips on writing great answers.



Required, but never shown



Required, but never shown




By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

Edmonton

Crossroads (UK TV series)