Java - Rome rss reader?

2019-03-29 17:06发布

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 *

2条回答
闹够了就滚
2楼-- · 2019-03-29 17:50

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.

查看更多
劫难
3楼-- · 2019-03-29 17:59

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.

查看更多
登录 后发表回答