How to set up my project in Intellij to use the ROME library to read a RSS Feed ?
So far I have developed the following:
import com.sun.syndication.feed.synd.SyndFeed; import com.sun.syndication.io.SyndFeedInput; import com.sun.syndication.io.XmlReader; import java.net.URL; public class ReadRSS { public static void main(String[] args) { String urlString = "http://news.ycombinator.com/" boolean ok = false; if (args.length==1) { try { URL feedUrl = new URL(urlString); SyndFeedInput input = new SyndFeedInput(); SyndFeed feed = input.build(new XmlReader(feedUrl)); System.out.println(feed); ok = true; } catch (Exception ex) { ex.printStackTrace(); System.out.println("ERROR: "+ex.getMessage()); } } if (!ok) { System.out.println(); System.out.println("FeedReader reads and prints any RSS/Atom feed type."); System.out.println("The first parameter must be the URL of the feed to read."); System.out.println(); } } }
But, I get some errors when running my code, mainly from the option:
.. java: package com.sun.syndication.feed.synd does not exist ..
How to import a package in Intellij ? I managed to import this added jar into my project structure.
But the following problem: I cannot access org.jdom.Document - although I installed jdom in my project structure. The error I get is this
Error: (16, 38) java: unable to access org.jdom.Document class file for org.jdom.Document not found
How can i solve this?
source share