Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Javabean subclass does not compile.

Status
Not open for further replies.

cyan01

Programmer
Mar 13, 2002
143
US
Hi, Experts,

I'm new to jsp and javabean. I have a very simple base class Book.java and a subclass TechnicalBook.java. The file structure is as follows:

%CATALINA_HOME%\webapps\test\WEB-INF\classes\booklibrary\Book.java
%CATALINA_HOME%\webapps\test\WEB-INF\classes\booklibrary\TechnicalBook.java

Here is the code of Book.java:

Code:
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;
  }
}

And here is the subclass:

Code:
package booklibrary;

public class TechnicalBook extends Book
{
  private String skillLevel;
  public String getSkillLevel()
  {
    return this.skillLevel;
  }
  public void setSkillLevel(String s)
  {
    this.skillLevel = s;
  }
  public String toString()
  {
    return getTitle();
  }
  public TechnicalBook(String title)
  {
    super(title);
  }
}

The base class was compiled ok. But the subclass does not complie:

Code:
%CATALINA_HOME%\webapps\test\WEB-INF\classes>javac booklibrary\TechnicalBook.java

booklibrary\TechnicalBook.java:3: cannot find symbol
symbol: class Book
public class TechnicalBook extends Book
                                   ^
booklibrary\TechnicalBook.java:20: cannot find symbol
symbol  : method getTitle()
location: class booklibrary.TechnicalBook
    return getTitle();
           ^
2 errors

BTW, I am using jdk 1.5 on win xp. Thank you for your help.
 
did you import your classes on the jsp page?

<%@ page
import="booklibrary.*"
%>

=========================================================
-jeff
try { succeed(); } catch(E) { tryAgain(); } finally { rtfm(); }
 
Jeff, he is comiling a .java file from the command line - not a JSP.

cyan01,
I answered your question in the Java forum. In the future please do not crosspost questions between different forums as it is annoying for people who answer questions in both forums.

--------------------------------------------------
Free Database Connection Pooling Software
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top