[jcifs] I have forgotten how to compile Java code.

Michael B Allen mba2000 at ioplex.com
Thu Aug 12 06:33:46 GMT 2004


On Thu, 12 Aug 2004 00:06:44 -0500
ddkilzer at kilzer.net (David D. Kilzer) wrote:

> The classpath points to where the *.class files are located.  Unless
> you've compiled ndr/NdrLong.java into ndr/NdrLong.class relative to the
> current directory (.), javac won't be happy when you compile
> NetShareEnumAll.java.  (It won't find NdrLong.class if it's in the
> current directory because it should be found under a directory called
> "ndr" from the current directory.)

I compiled the ndr classes like:

$ javac ndr/NdrBuffer.java

NdrBuffer references some other classes in the ndr package resulting in all
classes being compiled and residing in the ndr directory.

> You've also done "import ndr.NdrLong;" inside NetShareEnumAll.java,
> right?

Well import ndr.*;

So compiling the NetShareEnumAll.java in the current directory should cause
the compiler to look for the file ndr/NdrLong.class.

Right?

> On Thu, Aug 12, 2004 at 12:54:37AM -0400, Michael B Allen wrote:
> 
> > Ok, I think I've been using Ant for so long I've forgotten how to basic
> > stuff.
> > 
> > I have a class file in an ndr subdirectory:
> > 
> > $ cat ndr/NdrLong.java 
> > package ndr;
> > 
> > public class NdrLong extends NdrObject {
> > 
> > 	public int value;
> > ...
> > 
> > If I do javac ndr/NdrLong.java all goes well. But if I try to compile
> > another class against those classes I get an error:
> > 
> > $ javac -verbose -classpath . NetShareEnumAll.java
> > [parsing started NetShareEnumAll.java]
> > [parsing completed 181ms]
> > [loading
> > /usr/local/j2sdk1.4.1_02/jre/lib/rt.jar(java/lang/Object.class)][loading
> > /usr/local/j2sdk1.4.1_02/jre/lib/rt.jar(java/lang/String.class)]
> > NetShareEnumAll.java:9: cannot resolve symbol symbol  : class NdrLong 
> > location: class NetShareEnumAll
> >     NdrLong level;
> >     ^
> > NetShareEnumAll.java:10: cannot resolve symbol
> > symbol  : class NdrObject 
> > location: class NetShareEnumAll
> >     NdrObject info;
> >     ^
> > So what in the world am I doing wrong here? I think I need to break out
> > the"How to Program" book.
> > 
> > Mike
> > 
> > -- 
> > Greedo shoots first? Not in my Star Wars.
> 


-- 
Greedo shoots first? Not in my Star Wars.


More information about the jcifs mailing list