Java - Rome rss reader?

点点圈 提交于 2019-12-05 00:13:13

问题


I am trying to read rss. I copied the jar file in to my libs folder, and I added the jar file to my eclipse project as a library. In order and export i checked my jar file.

Now I am trying to use the rss reader provided by rome

import com.sun.syndication.feed.synd.SyndEntry;
import com.sun.syndication.feed.synd.SyndFeed;
import com.sun.syndication.io.SyndFeedInput;
import com.sun.syndication.io.XmlReader;

URL url  = new URL("http://myUrlGoesHere");
XmlReader reader = new XmlReader(url);      
SyndFeed feed = new SyndFeedInput().build(reader);

I get the following error on the last line: The type org.jdom.Document cannot be resolved. It is indirectly referenced from required .class file

What does this mean? What is the solution? * no error on imports *


回答1:


In addition to copying Rome's jar file to your libs folder, you also need to add JDOM's library (jar) to your class path.

The error you are getting says that someone is indirectly referencing JDOM's jar. Probably someone on Rome or any other library you don't control.




回答2:


In order to get it to compile I had to use the jdom-1.1.3.jar file from http://www.jdom.org/dist/binary/archive/. After the zip file is extracted it can be found in the directory jdom-1.1.3\jdom\build.

You will need to right click on your project| Select Properties | Java Build Path | Libraries | Add External JARs.



来源:https://stackoverflow.com/questions/5285807/java-rome-rss-reader

工具导航Map