• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Abstract Classes - A Problem

 
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
 
Steve Jensen
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
High Plains Drifter
Posts: 7289
Netbeans IDE VI Editor
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 1056
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Steve Jensen
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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!!
 
He baked a muffin that stole my car! And this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic