Java Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesJava Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old April 25th, 2003, 06:46 PM
codechimp codechimp is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Posts: 15 codechimp User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Extending a class

Hi All,

I am having a problem extending a class and I am not sure why.

When I run:
C:\tomcat5\jakarta-tomcat-5\dist\webapps\FaustJSP\WEB-INF\classes\booklibrary>javac ChildrenBook.java

When I try to compile the .java file I get the following error:

ChildrenBook.java:3: cannot resolve symbol
symbol : class Book
location: class ChildrenBook
public class ChildrenBook extends Book
^
1 error

Here is my ChildrenBook.java file:
package booklibrary;

public class ChildrenBook extends Book
{
private int minimumAge;

public int getMinimumAge()
{
return this.minimumAge;
}
public void setMinimumAge(int a)
{
this.minimumAge = a;
}
public ChildrenBook(String title)
{
super(title);
}
}

I have the Book.java and Book.class files within the same directory as the ChildrenBook.java file above.

Here is the code for Book.java
package booklibrary;

public class Book
{
private String title;
public String getTitle()
{
return title;
}
public void setTitle(String newTitle)
{
this.title = newTitle;
}
public Book(String title)
{
this.title = title;
}
}
Book.java compiles correctly.

Thanks,
CC

Reply With Quote
  #2  
Old April 25th, 2003, 07:41 PM
Kapil Kapil is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Location: Bogotá, Colombia
Posts: 43 Kapil User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Send a message via ICQ to Kapil Send a message via AIM to Kapil Send a message via Yahoo to Kapil
The classpath has to contain the path Book.class is in, cause it's not finding it.

Try this:
set CLASSPATH=%CLASSPATH%;C:\tomcat5\jakarta-tomcat-5\dist\webapps\FaustJSP\WEB-INF\classes\booklibrary

Reply With Quote
  #3  
Old April 25th, 2003, 07:46 PM
codechimp codechimp is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Posts: 15 codechimp User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Classpath already set

The classpath is already set to go all the way down to the booklibrary directory.
--
cc

Reply With Quote
  #4  
Old April 26th, 2003, 01:21 AM
Kapil Kapil is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Location: Bogotá, Colombia
Posts: 43 Kapil User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Send a message via ICQ to Kapil Send a message via AIM to Kapil Send a message via Yahoo to Kapil
If you're in the booklibrary dir running javac ChildrenBook.java you'll get an error as it'll look for Book.java in a dir named booklibrary inside the current dir. You have to cd .. and then run javac booklibrary/ChildrenBook.java

Does that work?

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesJava Help > Extending a class


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
Stay green...Green IT