Search code examples
javaexceptionimportpackagerome

How to use ROME for RSS


I am using the code from Rome's tutorials page http://wiki.java.net/twiki/bin/view/Javawsxml/Rome05TutorialFeedReader .

When I try to compile, it says class FeedReader is public, should be declared in a file named FeedReader.java.

I am new to Java, but I think that the FeedReader class should be part of the package used in the example, or in one of the import paths. I can't find file com.sun.syndication.samples (which is the package from the example) in the Rome library I downloaded. Any thoughts?


Solution

  • The code from your tutorial is

    package com.sun.syndication.samples;
    
    public class FeedReader {
        ...
    }
    

    It must be in a file named FeedReader.java and put in a directory com/sun/syndication/samples. If you change the name of the class, you must change also the name of the java file. If you change the package declaration, you must also change the location of the file.