Which jar files to use?

I know this is an incredibly remedial question, but numerous Googles and searches of these forums has not resulted in enlightenment.

I downloaded and and am trying to play with the "webstarterappII" sample from Oracle using JDeveloper 10g. Not that that is particularly relevant because I've done quite a bit of development in Eclipse and standard Java and run into the same issue. In my defence, I've not had any formal training in Java, just what I've gleaned by working with it.

There are numerous compile errors of the type, "Imported class 'xxx.xxx.xxx' not found". I know the proper jar files are probably present on my machine, the problem is that the JavaDocs for the missing classes do a fine job of describing the class but nowhere can I find *anything* that tells me which .jar file contains the classes I'm missing. I can see no particular pattern that relates Java classes to the names of the .jar files that contain them for the classes that *are* present.

How do I determine which .jar files to add to the classpath for this project? Is there some source of inspiration for the class->jar mapping that I am unaware of? I suppose I could do a recursive jar tvf and grep the results, but I can't imagine someone more clever than I hasn't already addressed my issue...

I can only assume that in this particular case I'm thoroughly incompetent at searching, something I am usually quite adept at.

Thanks in advance for any feedback. [Ducking in anticipation of repeated comments about being a complete m0ron.. ;-]

[1573 byte] By [BiFla] at [2007-11-27 0:29:20]
# 1
You could always just throw all the jars on your classpath and not worry about it.
Djaunla at 2007-7-11 22:31:38 > top of Java-index,Java Essentials,Java Programming...
# 2
That's an idea; the perfectionist in me rankles a bit at the thought, and there are 1556 jar files in 415 directories just in the Oracle subtree... I'm sure many are duplicates. Makes for a rather large classpath unless I can whittle it down some...
BiFla at 2007-7-11 22:31:38 > top of Java-index,Java Essentials,Java Programming...
# 3
Binary search approach ?Add them all in see if it works, if it does remove half of them from the subtree, continue until you are left with 1 as result ?Should get it right in about 15 compiles.
Aknibbsa at 2007-7-11 22:31:38 > top of Java-index,Java Essentials,Java Programming...
# 4

Hmmm. Either my question is SO remedial as to not warrant a response, or there is no good answer.

<Applying bullseye to chest>

I will presume there is no good answer, since I have yet to see a newb not get nuked when wasting the time of the Gods.

</Applying bullseye to chest>

BiFla at 2007-7-11 22:31:38 > top of Java-index,Java Essentials,Java Programming...
# 5

Normally when tutorials are referring to classes that aren't in the standard Java API, they say something like "Download the wotsit.jar file from Sourceplodge". Does your tutorial say nothing at all about that? If so, perhaps they are standard Java classes and you're expected to look in the documentation or use JDeveloper to autogenerate your import statements.

At any rate it's pretty hard to respond to vague allegations about tutorials we have no access to.

DrClapa at 2007-7-11 22:31:38 > top of Java-index,Java Essentials,Java Programming...
# 6

Thanks for your response. I agree that trying to answer questions about what might be documented for specific applications or tutorials is next to impossible without a working knowledge of them. I mentioned a specific case, which in my case isn't a tutorial but a sample application.

My query was intended to discover if there is a standard methodology in Java for associating class libraries with specific jar files, or some tool that could help one identify the proper jar file for a missing class.

Here's an example: Say you are getting an "Import not found" error for "javax.swing.beaninfo.SwatchPanel". How do you discover that the jdk1.6.0/lib/dt.jar file contains that class? It's a common Java class associated with Swing, but the JavaDocs for javax.beaninfo.<anything/everything> don't say a thing about the dt.jar file.

This seems to be the norm for all Java packages I've looked at. Occasionally I will get lucky and find a reference via a Google search where someone has mentioned a class and the jar it's in, but those have been few and far between...

Not trying to be difficult, just not yet enlightened...

BiFla at 2007-7-11 22:31:38 > top of Java-index,Java Essentials,Java Programming...