Hi Roy: I tried your suggested code exactly as you specified. It compiled both files OK, but when I ran MyTest, I got a run-time error of "NoClassDefFoundError". I STILL have found only 1 way to get this code to run. That is as I said before, to extend MyClass, and put both files in the SAME package. No other way works! If you have found another way to get these 2 files to run, PLEASE let me know. Thanks!
This looks like a CLASSPATH problem. If you have included the classpath variable with a path to access your first class and have defined the second class in another package without specifying the CLASSPATH for this second class, the class will not be found.
The value of your CLASSPATH (for Oliver, not me; my CLASSPATH is empty and this example still works for me)
Directory listings for the directories where you've put the two files in my example. (Note the plural; to reproduce my environment, you've gotta have two source files in two directories, and each directory should have exactly one source file.)
Please forgive me if this seems trivial; I want to be sure you've got the proper environment set up before we start digging into other things. Bartenders, maybe you can see something obvious that I can't? Or maybe there's a question I'm not asking that I should be asking? Though I've programmed for many years, I am also new to Java, and might not be asking all of the right questions. [This message has been edited by Roy Tock (edited July 25, 2001).]
Can I just echo Marilyn's request to NOT start a new thread each time you post? It makes it extremely difficult to help you. I've had to look through 5 different threads now, just to track down something you've said in this one.
And please... do what Roy asks in this thread and reply to this thread. Knowing what JDK you are using is very helpful, because as I've mentioned in a previous thread, 1.3 acts very differently regarding packaging and compiling, than every other JDK's. Also, the error messages you get with 1.1.8 and 1.2.2 are differnet for the same problem. As Roy mentions, your CLASSPATH should not cause a problem like this. And as I've also mentioned before, and Roy has repeated... where are your source files?
I apologize if these questions are 'asked and answered', but I guess I got tired of looking through 5 threads looking for your replies. (ok, rant over)