wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes Abstract Classes - A Problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Abstract Classes - A Problem" Watch "Abstract Classes - A Problem" New topic
Author

Abstract Classes - A Problem

Steve Jensen
Ranch Hand

Joined: Sep 23, 2002
Posts: 126
I'm reading a chapter on Abstract Classes form a Java book, (Java 2 by Tom Swan).
Well, I'm trying to compile the listing in his book, and it just won't work.
The errors I get are as follows:

And the 4 java classes are listed below.

Any help on what the problem is would be GREATLY appreciated.

[ November 21, 2002: Message edited by: Michael Ernest ]

John Bonham was stronger, but Keith Moon was faster.
Andrew Fischer
Greenhorn

Joined: Nov 18, 2002
Posts: 21
Originally posted by Steve Jensen:
I'm reading a chapter on Abstract Classes form a Java book, (Java 2 by Tom Swan).
Well, I'm trying to compile the listing in his book, and it just won't work.
The errors I get are as follows:

"AbstractDemo.java": Error #: 361 : class required, but identifier found at line 2, column 2
"AbstractDemo.java": Error #: 300 : class TMyObject not found in class AbstractDemo at line 8, column 29
"AbstractDemo.java": Error #: 300 : class TMyObject not found in class AbstractDemo at line 9, column 29
"AbstractDemo.java": Error #: 300 : class TMyObject not found in class AbstractDemo at line 10, column 29
"AbstractDemo.java": Error #: 300 : class TMyObject not found in class AbstractDemo at line 11, column 29
"AbstractDemo.java": Error #: 300 : class TMyObject not found in class AbstractDemo at line 12, column 29
"AbstractDemo.java": Error #: 300 : class TMyObject not found in class AbstractDemo at line 13, column 29
"AbstractDemo.java": Error #: 300 : class TMyObject not found in class AbstractDemo at line 14, column 29
"AbstractDemo.java": Error #: 300 : class TMyObject not found in class AbstractDemo at line 15, column 29
"AbstractDemo.java": Error #: 300 : class TMyObject not found in class AbstractDemo at line 16, column 29


And the 4 java classes are listed below.

AbstractDemo.java
import TContainer;
import TMyObject;
(everything inbetween omitted)
TmyObject.java
Any help on what the problem is would be GREATLY appreciated.

You didn't say what your development environment is, but if you are using one with case sensitive file names then you have a naming problem.
import TMyObject
won't find
TmyObject.java


Andrew Fischer
SCJP
Steve Jensen
Ranch Hand

Joined: Sep 23, 2002
Posts: 126
Originally posted by Andrew Fischer:

You didn't say what your development environment is, but if you are using one with case sensitive file names then you have a naming problem.
import TMyObject
won't find
TmyObject.java

OK, i may have referred to TmyObject.java in my post, but I can't find any record of me typing it like this, anywhere. I've used TMyObject in the actual code. I'm using JBuilder 6, if that's of any help.
Andrew Fischer
Greenhorn

Joined: Nov 18, 2002
Posts: 21
Originally posted by Steve Jensen:

OK, i may have referred to TmyObject.java in my post, but I can't find any record of me typing it like this, anywhere. I've used TMyObject in the actual code. I'm using JBuilder 6, if that's of any help.

Darn, I thought I found it. Nothing else jumped out at me.
You might have some sort of configuration problem related to the default package or where the compiler is looking for files. I've never used JBuilder so I won't be any help if this is a build settings or configuration problem. Sorry I can't be of more help.
Michael Ernest
High Plains Drifter
Sheriff

Joined: Oct 25, 2000
Posts: 7292

It might be that your CLASSPATH doesn't include the directory you're working, or that you need a package delcaration of some sort for your code to compile.


Make visible what, without you, might perhaps never have been seen.
- Robert Bresson
Ron Newman
Ranch Hand

Joined: Jun 06, 2002
Posts: 1056
This compiles and runs fine on my system, assuming that I name and capitalize the file names properly to match the class names.
If you have a CLASSPATH environment variable defined, make sure it includes "." (the current directory)
[ November 24, 2002: Message edited by: Ron Newman ]

Ron Newman - SCJP 1.2 (100%, 7 August 2002)
Steve Jensen
Ranch Hand

Joined: Sep 23, 2002
Posts: 126
Originally posted by Ron Newman:
This compiles and runs fine on my system, assuming that I name and capitalize the file names properly to match the class names.
If you have a CLASSPATH environment variable defined, make sure it includes "." (the current directory)
[ November 24, 2002: Message edited by: Ron Newman ]


Cheers!
Thanks to all those who took the trouble to have a look at my problem!!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Abstract Classes - A Problem
 
Similar Threads
Sample Questions from Sun
Declaring an array of objects of a class ???
Confused with file read
.Class not found?
problem with JTable & abtractTablemodel