[jdom-interest] help please

frederick bloom fred.bloom at central.sun.com
Wed Mar 14 08:14:13 PST 2001


Since it is now working, the class is already in your classpath.  This class
my be by itself, in the filesystem, or in a Jar file that you have in your
classpath or in the -cp option to "java ..."

This is more of a name scoping issue.  Without the "import .." statement at
the top of your java sourcefile, the compiler is unable to find a class
Document to work with.  Adding the import directive makes class Document, in
package org.jdom, available to the compiler.  You have imported a single class
in the namespace of org.jdom  

You will always need to accomplish this in some fashion.  For example, an
alternative would be to not use the import directive and use org.jdom.Document
in every place where you currently have just "Document".  This is the approach
that must be used if you wish to use two "class Document"s that are from
different packages:

ie:
	org.jdom.Document
		and
	some.other.packagename.Document
This results in a namespace clash

Thank you, Fred Bloom

Hugh Mc Gauran wrote:
> 
> well thanks to Paul Jakubik it now works
> 
> all i had to do was add import org.jdom.Document; at the top and it
> worked
> 
> what do i need to have in my classpath for this to be automagically in
> 
> hugh
> 
> On Wed, 14 Mar 2001, Ian Lea stated:
> > Hard to tell much from this.  Has the source got the correct import
> > statements?  Or try changing line 16 to org.jdom.Document doc =
> > whatever.
> > What exactly is your classpath set to?
> >
> >
> > --
> > Ian.
> > ian.lea at blackwell.co.uk
> >
> >
> > Hugh Mc Gauran wrote:
> > >
> > > java 2 sdk v1.3
> > >
> > > On Wed, 14 Mar 2001, GB/DEV - Philip Nelson stated:
> > > >
> > > > > cantona % javac InAndOut.java
> > > > > InAndOut.java:16: cannot resolve symbol
> > > > > symbol  : class Document
> > > > > location: class InAndOut
> > > > >
> > > > >       Document doc = b.build(new File(filename));
> > > > >       ^
> > > > > 1 error
> > > >
> > > > Appears to be a syntax error, but what version of java are you using?
> 
> --
> Regards
> Hugh
> 25 Plassey Vge,Castletroy, Limerick.
> House Tel 061 337125             Mobile 086 8298 707.
> Email cantona at skynet.ie          Web http://hughmc.csn.ul.ie
> 
> __
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fred.bloom.vcf
Type: text/x-vcard
Size: 371 bytes
Desc: Card for frederick bloom
Url : http://jdom.org/pipermail/jdom-interest/attachments/20010314/b8439fbb/fred.bloom.vcf


More information about the jdom-interest mailing list