Re: Passing objects (not stones)

From: Ryan Stewart (zzanNOtozz_at_gSPAMo.com)
Date: 02/27/04


Date: Thu, 26 Feb 2004 19:10:33 -0600


"NotAsDumbAsILook" <toyota_trekker@yahoo.com> wrote in message
news:e3d370c6.0402260942.73c2e895@posting.google.com...
> Oops! I was "simplifying" the code I posted and didn't rename that
> MPNode as MyClass. That might be a little confusing.
>
> Anyhoo, I figured out what the problem was, but I don't understand why
> it was a problem. So, I'm going to alter the question.
>
> Like I said before, I'm using NetBeans 3.5.1. I was putting together a
> little sample application so that I could figure out how to make a
> good TableClass while working with an ArrayList of Objects. Well, in
> order to save time coding, I copied over the class MyClass from
> another project I am working on using the NetBeans Filesystem Explorer
> (you right-click, copy, and then paste-as-copy in the new Filesystem).
> Apparently there is something in the background that was giving
> NetBeans grief. I could declare a new MyClass() object, and then use
> the Code Completion to see the methods and variables in it. But, when
> it came to compile time, the compiler couldn't see those methods, so
> it was giving the "cannot resolve symbol" error.
>
> I vaguely remembered seeing a similar problem with Delphi a few years
> ago, and I tried a similar fix I used then. I created a new class
> inside of the Filesystem I was working in - by doing a right-click,
> new, java class. Then I cut and pasted the code from the original
> MyClass into this new one, and referenced it instead of the old
> MyClass object. Now the code complies just fine.
>
> So, the error lies in copying a class from one filesystem into
> another. I know that you normally wouldn't do that, but there is the
> rare occasion where you would. Any thoughts?
It depends on what exactly you're doing. If you're pasting into a
subdirectory of a mounted directory, your file is not in the classpath. It's
considered part of a Java package. Therefore you must have a package
statement in the source file and import the package in order to use class.



Relevant Pages

  • importing for package
    ... simple and clean, following the directory concept. ... tries to import the class defined in the package. ... And the code for Exercise2.java (which tries to import the MyClass file): ... The MyClass class seems to get imported, however I get an error message when ...
    (comp.lang.java.programmer)
  • Re: __init__.py in packages
    ... >>>From what I can gather it is for initialization of the package when doing an ... > from foo.core import MyClass ... from Mary.Poppins import Pinochio # the electromagnetics simulator. ...
    (comp.lang.python)
  • "compiling time" package loading
    ... I am trying to do the following thing: depending on optional parameter ... of my "MyClass", I want to load different package, says if I declare ... the package A_package should be loaded automatically... ...
    (comp.text.tex)
  • RE: PyDev multiple source files?
    ... therefore to 'include' access to 'myclass' in file xyz.py from another file called 'abc.py' you would put this in abc.py ... imports etc, doing wxpython stuff blah, blah, blah. ... Now I want to be able to break my single source file up into multiple ... equivalent of 'include' statements in there with all my globals ...
    (comp.lang.python)
  • Re: Repost: easy include question
    ... >include the directory where MyClass resides. ... >have to load MyClass source and header to the project. ... It's the source file that's the issue, ...
    (microsoft.public.vc.language)