Including JAR files in Eclipse 4.2, specifically Rome (RSS Feed parser)

G

galois271

Hi all,

I am new to putting third party files/libraries/JARS whatever you want to call them into my projects using Eclipse. I, specifically, want to include Rome, the RSS Feed parser, into my Java project in Eclipse. Rome depends on JDOM.

Can anyone tell me how to do this? I tried installing "External JARS", but I keep getting this in Eclipse:

"The type org.jdom.Document cannot be resolved. It is indirectly referenced from required .class files"

Here is my code:

import java.net.*;
import java.io.*;
import java.util.Iterator;

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;

public class EclipseTest
{

/**
* @param args
* @throws IOException
*/
public static void main(String[] args) throws IOException
{
URL url = new URL("http://viralpatel.net/blogs/feed");
XmlReader reader = null;

try {

reader = new XmlReader(url);
Error-> SyndFeed feed = new SyndFeedInput().build(reader);
System.out.println("Feed Title: "+ feed.getAuthor());

for (@SuppressWarnings("rawtypes")
Iterator i = feed.getEntries().iterator(); i.hasNext();)
{
SyndEntry entry = (SyndEntry) i.next();
System.out.println(entry.getTitle());
}
}
finally
{
if (reader != null)
reader.close();

}
}

}


Thanks a ton!
 
G

galois271

Sounds like you're missing a jar file

the distribution site for your third party lib should list all required

dependencies.
You could try refreshing your project

also check out the .classpath xml file in your project root

I've had to manually tweek this in the past to get things working.



lipska



--

Lipska the Kat©: Troll hunter, sandbox destroyer

and farscape dreamer of Aeryn Sun

I have put all the JDOM and ROME files into the project and refreshed, but I am still getting the above error. I don't know anything about the .classpath xml file. ??

Thanks, though!
 
J

Jeff Higgins

"The type org.jdom.Document cannot be resolved. It is indirectly referenced from required .class files"
I've pasted you’re error message verbatim into my browser search box.
There seems to be about four common problems.
Jdom version, Jdom distribution packaging, seem to be the most common.
 
G

galois271

So, I downloaded jdom-1.1.3, added this to the build path and removed
jdom-2.0.5, after changing throws IOException to throws Exception the

project built with no errors.



Try adding jdom-1.1.3 and removing jdom-2.0.5 ... works for me.



lipska



--

Lipska the Kat�: Troll hunter, sandbox destroyer

and farscape dreamer of Aeryn Sun

Thanks guys! I did like 10 searches with the error and saw nothing but sites about JDOM & Rome capabilities. ??
 
L

Lew

It is better to catch the specific 'Exception', and worth the effort to find out which
one that is.

What about warnings?

How rigorous are your warning settings?

I recommend resolving the dependencies at the command line, using Ant, first.
Then work through the project "Build Path" in Eclipse to ensure that it matches.

Without a doubt you are missing a piece therein. Since your posts lack specifics it
is very difficult to be specific in turn.

Eclipse should not be your primary build environment.
 
C

Chuck Johnson

Hmm...? I didn't write anything after the thanks post, so I don't know how this comment about throwing exceptions got up here. It wasn't me. ??
 
A

Arne Vajhøj

Are you sure you know who you are replying to Bloch local?

No reason to think he don't.
None of your bloody business


The OP has it working now Bloch so why don't save your breath.

That something is working does not mean that good advice can
not be given.
What the hell are you saying now you idiot.
I can only assume you think you are responding to the OP.

You don't use Ant to build a simple single class that only exists to
test your path do you? why are you spreading this mis-information, why
do you have to over-complicate everything? KISS.

You can build with Ant in Eclipse, I've built huge systems with Ant in
Eclipse, Eclipse is a great build tool it's my primary build
environment. Don't listen to Bloch local OP, Eclipse is a great build
tool, loads of professional developers I know use Eclipse as their
primary build environment.

Stop spreading mis-information.

It is very bad practice to use the IDE as primary build environment
(at least if we assume that primary means the official builds).

The risk of stuff not checked into source control being included
in the build and build options being development oriented instead
of production oriented is way too big.

But if the original code posted is just a SSCCE to illustrate
the problem, then I can not see a problem in this specific case
either.
... And who's this Chuck Johnson geezer

OP

Arne
 
J

Jeff Higgins

The OP had a problem with Eclipse, as it turns out it was actually a
problem with incompatible third party components. 'Helping' the OP by
telling him not to use Eclipse to build his project wasn't really
answering the question was it.
As it turns out Chuck has begun his Java education at a horrendous
starting place.
 
J

Joerg Meier

As it turns out Chuck has begun his Java education at a horrendous
starting place.

I wish those two would just put each other in their respective softwares
filter and stop polluting every second thread with their name calling and
personal attacks. I find both of them usually make good and worthwhile
posts, so I wouldn't want to filter them myself, it's just that when they
reply to each other that it becomes more noise than signal :|

Liebe Gruesse,
Joerg
 
A

Arne Vajhøj

The OP had a problem with Eclipse, as it turns out it was actually a
problem with incompatible third party components. 'Helping' the OP by
telling him not to use Eclipse to build his project wasn't really
answering the question was it.

Correct.

But the question of IDE build came up in the thread.

And that is a bad practice for real builds.

Arne
 
A

Arne Vajhøj

As it turns out Chuck has begun his Java education at a horrendous
starting place.

It happens. If he was an expert in what would be a good starting
point, then he would not be a beginner.

20 years ago I like to write my own low level IO library in assembler.
That somewhat worked OK until I tried writing GUI stuff more
specifically use of Xlib the same way.

:)

Arne
 
L

Lew

First, it's spelled "misinformation".

Second, that's like "stop beating your wife". The premise is false.

Can't stop what I ain't doing.

Indeed. That is not misinformation.

Since no one told him not to use Eclipse to build his project, it seems youare the
one spreading misinformation.

The actual advice was:
You are guilty of straw-man argumentation, lipska.
Correct.

But the question of IDE build came up in the thread.

And that is a bad practice for real builds.

I've seen the practice of using Eclipse to do "real" builds cause massive trouble
on major multi-million-dollar projects. It's a genuine problem.

Some with minimal real-world experience or a rabid need to disagree irrespective of truth
and facts may tell you otherwise.
 
J

Jeff Higgins

It happens. If he was an expert in what would be a good starting
point, then he would not be a beginner.

20 years ago I like to write my own low level IO library in assembler.
That somewhat worked OK until I tried writing GUI stuff more
specifically use of Xlib the same way.

:)
Yep.
Perhaps I've been harsh.
I'm in the very same boat with Chuck, heading aft.
I can sympathize.

For some months I've taken an earnest interest in a subject
for which there is an excellent laboratory implemented in a
Python environment. It is written by experts in both the
subject matter and in Python. Several years ago I determined
to learn the Python language. I spent a good year at it and
before loosing interest felt that I had a fair understanding.
Now I find myself exploring an unfamiliar subject in what
turns out to be an unfamiliar programming environment.

It is frustrating to have to diverge, sometimes for many hours,
from studying the matter at hand to unraveling an implementation
issue, something that should be simple but simply isn't.

What I cannot sympathize with is the "I'm busy and have better
things to do" attitude. When pressed Chuck replies with, "I'm
a working student I really don't have the time for all of that"
and "I was really hoping for an expert to show me what to do,
but since there are none here could you just point me to a wiki/tutorial
or something?". Hell no, I say. Among other
responsibilities I've been a "working student" for forty plus
years and have just spent a precious few hours of my own
struggling to understand an unfamiliar language construct.
 
L

Lew

lipska said:
It's spelled straw man, no hyphen

Incorrect. The hyphen is needed when a unit modifier (like "straw man" in this case)
precedes the noun modified.
How useful do you think it is to tell someone struggling to get Eclipse
to do what he wants that he shouldn't be using it (for whatever reason)

What does that have to do with this conversation?

No one told the OP that he shouldn't use Eclipse, only that it should not be used
for production builds. That is incredibly useful.

And not because I think it's useful but because it has demonstrable benefits, as mentioned
upthread.

Bad habits are harder to unlearn than if you learn good habits to begin with.

Someone who only learns the micro-information needed for today's question without
a sense of where the road leads will learn more slowly. To be effective at computer
programming in particular, one must develop the habit of assimilating, even if superficially,
the nine-tenths of the knowledge iceberg that is submerged below the waterline of
"I think this is immediately useful". If you cannot cope with that kind of data, you will never
grow to be a very competent programmer.

Now, I realize lipska that your argumentation is motivated entirely by the desire to disagree
with me personally, and not to help the OP, which is why you resort to begging the question
(calling it "misinformation") and challenging the usefulness of a useful answer without actually
contributing any helpful information yourself.

But the fact remains that Eclipse is not optimal as a production build tool, and that there are
standard tools for Java projects that are superior and indeed, intended for the purpose. This is
always useful to know, even if you aren't prepared at this very instant in time to delve in depth
into the matter. Otherwise you might form the bad habit of relying on Eclipse for something for
which it is not well suited, and suffer the dire consequences thereof, while having to undo an
ineffective system and unlearn bad habits. Is that what you want for the OP?

So better to set up a signpost very early in the learning path, indicating that there are dangers
and liberating the OP to dig into that in depth now that they know there is something to research.

You would shackle them with your own arrogant prejudgment of what you in your narrow,
self-aggrandizing view of things deem is all they need, just to snark at someone whom for
some reason you have chosen to deprecate.

Better to know the truth than base your education on falsehood. The truth will set you free.
 
L

Lew

Arne said:

None of those address the issue of unit modifiers that precede the noun modified.

You missed my point entirely.

Any compound phrase, like "straw man" or "fully realized", is spelled without a hyphen when
it is in a standalone position in a sentence, that is, not used as an adjective preceding the noun.

When used as a unit modifier prior to a noun, it's hyphenated.

"The fallacy there is straw man."
"It is a straw-man argument."

"The project will be profitable once it is fully realized."
"Somehow the fully-realized project never made a profit."

So while it is true that "straw man" is spelled without a hyphen when the hyphen is
not required, that has no bearing on the misspelling that I called out.

I promise I will not try to correct you on fine points of non-English grammar.
 
A

Arne Vajhøj

None of those address the issue of unit modifiers that precede the noun modified.

You missed my point entirely.

Any compound phrase, like "straw man" or "fully realized", is spelled without a hyphen when
it is in a standalone position in a sentence, that is, not used as an adjective preceding the noun.

When used as a unit modifier prior to a noun, it's hyphenated.

"The fallacy there is straw man."
"It is a straw-man argument."

"The project will be profitable once it is fully realized."
"Somehow the fully-realized project never made a profit."

So while it is true that "straw man" is spelled without a hyphen when the hyphen is
not required, that has no bearing on the misspelling that I called out.

Did you read the links?

Two of them provide examples without hyphen in front of argument/arguments.

Now - I am not an expert in the English Language, but some
googling seems to indicate that the rules is not as hard as you
indicate.

Example:

http://www.gpo.gov/fdsys/pkg/GPO-STYLEMANUAL-2008/html/GPO-STYLEMANUAL-2008-8.htm

<quote>
Unit modifiers
6.15. Print a hyphen between words, or abbreviations and words,
combined to form a unit modifier immediately preceding the word
modified, except as indicated in rule 6.16 and elsewhere
throughout this chapter. This applies particularly to
combinations in which one element is a present or past
participle.

agreed-upon standards Federal-State-local cooperation
Baltimore-Washington road German-English descent
collective-bargaining talks guided-missile program
contested-election case hearing-impaired class
contract-bar rule high-speed line
cost-of-living increase large-scale project
drought-stricken area law-abiding citizen
English-speaking nation long-term loan
fire-tested material line-item veto
long-term-payment loan U.S.-owned property; U.S.-
flagship
low-cost housing 1-inch diameter; 2-inch-
diameter pipe
lump-sum payment a 4-percent increase, the
10-percent rise
most-favored-nation clause but
multiple-purpose uses 4 percent citric acid
no-par-value stock 4 percent interest. (Note the
absence of an article: a,
an, or the. The word of is
understood here.)
one-on-one situation
part-time personnel
rust-resistant covering
service-connected disability
state-of-the-art technology
supply-side economics
tool-and-die maker
up-or-down vote

6.16. Where meaning is clear and readability is not aided, it is not
necessary to use a hyphen to form a temporary or made compound.
Restraint should be exercised in forming unnecessary
combinations of words used in normal sequence.

atomic energy power national defense
appropriation
bituminous coal industry natural gas company
child welfare plan per capita expenditure
civil rights case Portland cement plant
civil service examination production credit loan
durable goods industry public at large
flood control study public utility plant
free enterprise system real estate tax
ground water levels small businessman
high school student Social Security pension
elementary school grade soil conservation measures
income tax form special delivery mail
interstate commerce law parcel post delivery
land bank loan speech correction class
land use program but no-hyphen rule (readabi-
lity aided); not no hyphen
rule
life insurance company
mutual security funds

</quote>

Arne
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top