Can't extend my own class (why?)

I am working my way through a JSP tutorial (Wrox publishing) and cannot compile my program: ChildrenBook.java
The tutorial has me extend the class Book (which I created and compiled).
The Book.class file is found in the "com\wrox\library\" directory.
Book is declared as public
It used in ChildrenBook as follows:
package com.wrox.library;
public class ChildrenBook extends Book
The file ChildrenBook.java is located in "com\wrox\library\" directory.
The error I receive from the compiler is:
cannot resolve symbol
symbol : class Book
I imagine I'm doing something wrong that is foolishly simple. Any thoughts are most appreciated.

I believe I have both classes in the same package. I
placed them both in the same directory
com\wrox\library\
In both the superclass and subclass I start with the
following code:
package com.wrox.library;
I just tried the import statement, as you suggested,
import com.wrox.library.Book;
and I get a "cannot resolve symbol" for my reference
to Book.You don't use "import" if all the classes are in the same package. The compiler and runtime environment will detect the classes.
>
As you stated, and this just confirms it, my program
is not recognizing the existence of my Book.class
file. I checked the properties of the file to see if
anything funky is going on with it but there is
nothing out of the ordinary.While compiling try using using -classpath directive and supply the correct class path.

Similar Messages

  • Can we extend the Throwable class instead of Exception Class??

    Hi all..
    Can we extend the Throwable class instead of Exception Class while creating our own custom Exception?If not Why?
    Please give your valuble advices..
    Ramesh.

    I don't want to hijack the thread here, but in a conversational tone...on a related note.. I've thought about this too a bit and wondered if there are some recommended practices about catching and handling Throwable in certain applications. Like the other day I was debugging a web application that was triggering a 500. The only way I could find the problem in an error stack was to write code to catch Throwable, log the stack, and then re-throw it. I considered it "debug" code, and once I solved the problem I took the code out because, my understanding is, we don't want to be handling runtime problems... or do we? Should I have a catch clause for Throwable in my servlet and then pass the message to ServletException?
    So along with the OP question, are there separate defined occasions when we should or should not handle Throwable? Or does it just all depend on circumstance?

  • How can I extend the Vector class?

    Hi All,
    I'm trying to extend the Vector class so I can get add a .remove(item:T) method to the class.  I've tried this:
    public class VectorCollection extends Vector.<T>
    That gives me the compile error "1017: The definition of base class Vector was not found"
    So then I tried:
    public class VectorCollection extends Vector
    Which gives me the compile error "1016: Base class is final."
    There must be some way to extend the Vector class, though, as on the Vector's official docs page it says:
    Note: To override this method in a subclass of Vector, use ...args for the parameters, as this example shows:
         public override function splice(...args) {
           // your statements here
    So there must be a way to extend the Vector class.  What am I doing wrong?

    No. AS3 doesn't currently have full support for generic types; Vector.<T> was added in an ad-hoc ("ad-hack"?) way. We are considering adding full support in a future version of ActionScript.
    Gordon Smith
    Adobe Flex SDK Team

  • How can i use my own class

    Hi everybody,
    I am using javawebserver2.0
    I have a class file(CreateTable.class) which i created to dynamically display the html table based on the query we pass as argument.
    When I try to load the jsp file where i creating an instance of the class(CreateTable.java) it shows page cannot be displayed.
    I have created the file alias in java web server to my local working directory (d:\\proejct\) as proj
    And i stored my class file in my current working directory(d:\\project)
    I dont know where do i wrong.
    the code is
    <%@ page language="java" contentType="text/html; charset=iso-8859-1" import="java.sql.*,java.io.*,test.clas.CreateTable" %>
    <%
    CreateTable ct=new CreateTable( );
    %>

    Please, see how work the TagLibs ....
    There is a good tutorial :
    http://java.sun.com/products/jsp/tutorial/TagLibrariesTOC.html

  • TextLayout not Serializable AND final class - can't extend and save objects

    As the title reads, I am using a TextLayout object in a class called Foo.
    I want to be able to serialize Foo and save it to the HD. This can't be done because TextLayout does not implement Serializable.
    So I tried to create a new class that extended the TextLayout class. This wasn't possible because TextLayout is defined as:
    public final class TextLayout
    extends Object
    implements Cloneable
    Basically, I have no clue how to be able to save my Foo class to the HD since I can't serialize the TextLayout object inside the Foo class. I would really appreciate help, because it is quite important that this works.
    Thanks.

    Siniz wrote:
    I have never dabbled with with transient variables, but I just read up on it and understand what you are getting at. Is this really the only way?
    The reason why I need to use TextLayout is because I need the bounding box of the text. I see no other way to get a bounding box around text than using TextLayout.That's a question for the swing/awt forums.
    I am also not entirely sure what you mean when you say I should write my own writeObject and readObject methods? You are saying I should entirely ditch the ObjectOutputStream methods?No, you implement those methods on your class in order to customize serialization. Please see the javadocs on the Serializable interface.

  • (updated)UIScrollBar and my own class. Can they works together?

    Hi Eone,
    i'm implementing a uiscrollbar in a class of mine that extends textfield. Unluckly it gives to me  a lot of 1120 error, undefined property, in each row i use a property of this component (except the constructor).
    I read somewhere that As2 not allow to use uisbar in other type of class that extends movieclip or textfiled or you know what...
    It's the same in As3?
    EDIT:
    I found a solution. Some method an properties of UISB can be used in the cvlass (like, contructor, update, target). Some otherelse not. So the other can be used only when i do an instance of my own class, like properties of the instance. Ex:
    textfield.UISB.x = 100;
    textfield: instance of my class
    UISB: scrollbar declared within my class
    x= properties defined only instancing my class

    You need to read the basics about Swing events.
    For starters, you do not implement listeners in your Applet class. Instead, you add new listeners to specific components that you want to listen on. For example, if you need to perform certain actions when a JComboBox's selection changes, you would do something like:
    my_combo.addActionListener(  new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            System.out.println("selection changed to: " + my_combo.getSelectedItem());
    });And for buttons:
    my_button.addActionListener( new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            System.out.println("You clicked " + ((JButton) e.getSource()).getText() " button);
    }MoustListener and other listeners can be similarily added. See JDK Documentation or Tutorials

  • Airport Express can only extend network, not create new one. Why?

    I am sharing a flat with some friends. The shared broadband router is placed in the living room. To strengthen the signal and make it easier for me to manage, I bought an Airport Express, connected it to the shared router with an ethernet cable and set up a wireless network of my own in my room. It was working fine, until recently we renewed our broadband contract. The router had been replaced by a new one (I don't know why) and the network configration had been changed. Since then I was not able to use my own network. In the Airport Utility display, the light of Airport Express is green, but the light of Internet is yellow, and the status is disconnected. I tried to change various other configuration on the Airport Express, and all in vain. Until I switched the network mode from 'Create a new wireless network' to 'Extend a wireless network', the Internet connection was finally back online. But this merely extends the existing network and not what I want. Why this happens? Why my Airport Express can only extend a network, not create one?

    Here is the situation on my Airport Express.
    If I choose to extend the existing wireless network, the Airport Utility shows like this:
    If I set up a wireless network of my own, what I get in the Airport Utility is this:
    See my problems here? The Airport Express does not show anything in amble, but the Internet complains that there is no connection.
    This problem did not occur before the broadband was renewed and the rounter was replaced.

  • Cann't extend a inner class where as can Implement a nested Interface

    i cann't extend a inner class in some other outer class . Where as i can implement the nested Interface in some other class. Why????
    for example:-
    class ABC
    class Inner
    /* class body */
    interface TempInterface
    /* interfacebody */
    class OuterClass
    class InnerTwo extends ABC.inner //(line 1)Will give error
    class InnerTwo implements ABC.TempInterface //(line 2)Will run fine
    the line 1 is going to give compilation error i.e not in the scope but the line 2 will run fine .
    Both of the things are in the same class but giving 2 other results.
    I am not getting sufficient reasons for it.
    Can any one help me????
    Reagrds
    Arunabh

    As far as the language is concerned, the classonly
    exists in the context of an instance of theenclosing
    class.This still exhibits a class/object confusion to me.
    It should be 'instance only exists ...' or 'instance
    can only exist'. The class only exists in the
    scope of the enclosing class, but this is another
    issue.I'm not following what you're saying. The second sentence sounds like you're disagreeing with me. The last sentence sounds like you're agreeing with me.
    A non-static nested class is an instance member, just like an instance method or instance variable. As such, as far as the language is concerned, that class only exists in the context of an instance of the enlcosing class.It's not just instances of the nested class--its the class definition itself that only exists within the context of an instance of the enclosing class. That's why you have to do anEclosingIntstance.NestedClass and can't do EnclosingClass.NestedClass.

  • How can I create a new own class in WebDynpro?

    I test the Web Dynpro for a while and found all the java classes were generated automatically. I've tried to create an own class. But after I rebuild the project, all of my own classes were cleared.

    Hi
    You can create your own class as mentioned in above replies or one more way,
    1. first you create your java project seperately,  there you can write all your business needs and then, make a jar or that then, you can include that project into your WDproject by
    rightclick on WDproject>properties>libraries>addexternaljars>ok
    2. create seperate java project
    rightclick on WDproject>properties>Projects>selectYourjavaProject>ok
    Regards
    Abhijith YS

  • Can any one please tell me why this e-class is not working

    Hi
    I want to listen the following e-class. But its not running. Can any one please tell me why its not working
    I have windows media player 11 in my system
    <a href="https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/media/uuid/34b9359e-0701-0010-f59d-ee014d5079b3?prtmode=navigate"></a>
    Best Regards
    Ravi Shankar B

    Hi
    I want to listen the following e-class. But its not running. Can any one please tell me why its not working
    I have windows media player 11 in my system
    <a href="https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/media/uuid/34b9359e-0701-0010-f59d-ee014d5079b3?prtmode=navigate"></a>
    Best Regards
    Ravi Shankar B

  • Why we can have only one public class in one source file

    why we can have only one public class in one source file

    When the java compiler is run it looks for classes referenced by the classes you are directly compiling. When looking for these referenced classes it looks for source as well as class files and compiles them automatically if the coresponding class files are missing, or older than the source.
    In order to do this it must be able to work out the source file name for any given class which might be referenced from another (the rule also applies to package level access).

  • Can Access Outside Dll's Friend Functions On Own Class

    Can Access Outside Dll's Friend Functions On Own Class?
    For Example:
    System.Web.Util's SecUtility ?SecUtility is : internal static class SecUtility

    See the answer by nobugz to this
    thread.

  • HT4259 I have a Netgear wndr3400 and I can "join a wireless network" but can not "extend a wireless network" on my Airport express.  Does anyone know why?

    I have a Netgear wndr3400 and I can "join a wireless network" but can not "extend a wireless network" on my Airport express.  Does anyone know why?

    Sorry, but "Extend a wireless network" is a proprietary Apple setting that will only work if you have another Apple router.
    It is not compatible with devices from other manufacturers.

  • Can interface extend abstract class?

    Can interface extend abstract class?
    I tried to make a interface extend an abstract class but i got an error stating:
    interface expected here.
    Can anyone help me ?

    > ok, but can an interface implement an abstract class?
    No. An interface provides no implementation whatsoever. An abstract class can implement an interface, but not the other way around.
    http://java.sun.com/docs/books/tutorial/java/concepts/interface.html
    ~

  • Can an abstract class extend another abstract class?

    Is it possible for an abstract class to extend another abstract class?
    Say
    public abstract class AComponent extends JComponent {
    Thanks.

    Yes

Maybe you are looking for