CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 9 of 9
  1. #1
    Join Date
    May 2011
    Posts
    4

    Cannot find sysmbol

    This is probably one of the most basic issues, but I am very new at Java and I have looked in many sites for a solution but can't find it so decided to post on this site.

    I have file 1: Attending.java

    BEGIN OF FILE CONTENT
    package com.gwt.client;
    /**
    * Indicates whether or not an Attendee will be attending an *
    */
    public enum Attending {
    /**
    * Indicates an Attendee will be attending.
    */
    Yes,
    /**
    * Indicates an Attendee will not be attending.
    */
    No,
    /**
    * Indicates an Attendee has not yet made up their mind
    * whether or not they will be attending.
    */
    Maybe
    }
    END OF FILE CONTENT

    This files compiles with no errors and creates Attending.class

    File 2: Attendee.java
    BEGIN OF FILE CONTENT
    package com.gwt.client;
    import java.io.Serializable;
    /** * A simple JavaBean class representing an entity associated to an appointment,
    * most likely a person, but might as well be a resource (like a conference room or a
    * projector).
    */

    @SuppressWarnings("serial")
    public class Attendee implements Serializable {

    /**
    * The <code>Attendee</code> name (if a person) or description
    * (when a resource).
    */
    private String name;

    /**
    * This <code>Attendee</code> email address.
    */
    private String email;

    /**
    * The status of attendance of this attendee to an <code>Appointment</code>.
    */
    private Attending attending = Attending.Maybe;

    /**
    * A URL to an image to depict this <code>Attendee</code>.
    */
    private String imageUrl;

    /**
    * Returns the name (if a person) or description (when a resource)
    * of this <code>Attendee</code>.
    *
    * @return The currently configured name of this attendee
    */
    public String getName() {
    return name;
    }

    /**
    * Sets the name (if a person) or description (when a resource)
    * of this <code>Attendee</code>.
    *
    * @param name The name of this attendee
    */
    public void setName(String name) {
    this.name = name;
    }

    /**
    * Returns this <code>Attendee</code> email address.
    *
    * @return The email address
    */
    public String getEmail() {
    return email;
    }

    /**
    * Sets this <code>Attendee</code> email address.
    * @param email The email address
    */
    public void setEmail(String email) {
    this.email = email;
    }

    /**
    * Returns the attendance status of <code>this</code> attendant
    * to the <code>Appointment</code> referencing it.
    * @return The attendance status of this <code>Attendee</code>
    */
    public Attending getAttending() {
    return attending;
    }

    /**
    * Sets the attendance status of <code>this</code> attendant
    * to the <code>Appointment</code> referencing it.
    *
    * @param attending The attendance status
    */
    public void setAttending(Attending attending) {
    this.attending = attending;
    }

    /**
    * Returns the URL to an image to (optionally) depict this <code>Attendee</code>
    * in the views.
    * @return A URL (relative or absolute) meaningful within the
    * deployed application context
    */
    public String getImageUrl() {
    return imageUrl;
    }

    /**
    * Sets the URL to an image to (optionally) depict this <code>Attendee</code>
    * in the views.
    * @param imageUrl A URL (relative or absolute) meaningful within the
    */
    public void setImageUrl(String imageUrl) {
    this.imageUrl = imageUrl;
    }
    }
    END OF FILE CONTENT

    This one is the one that give me java cannot find symbol Attending. The exact error is
    Ateendee.java:27 cannot find symbol
    symbol : class Attending
    location : class com.gwt.client.Attendee
    private Attending attending = Attending.Maybe;

    Thanks for any help

  2. #2
    Join Date
    Jun 1999
    Location
    Eastern Florida
    Posts
    3,877

    Re: Cannot find sysmbol

    Where is the definition for Attending? Is its class file on the classpath? The end of the classpath should contain the com\gwt\client folder. That folder should contain the Attending.class file.

    Perhaps your classpath should go up a couple of levels to be correct. Something like this:
    java -classpath ..\..\.;. .....
    Norm

  3. #3
    Join Date
    May 2011
    Posts
    4

    Re: Cannot find sysmbol

    Both Attending.java and Attendee.java are in com\gwt\client folder. No I don't have com\gwt\client on my CLASSPATH, but I do have other java files that I am compiling the same way without the directory on the CLASSPATH, it worked by just having them on the same directory. but I will add it to the CLASSPATH and try it again.

    Thanks

  4. #4
    Join Date
    Jun 1999
    Location
    Eastern Florida
    Posts
    3,877

    Re: Cannot find sysmbol

    it worked by just having them on the same directory

    Depends on if they are in packages.
    Norm

  5. #5
    Join Date
    May 2011
    Posts
    4

    Re: Cannot find sysmbol

    Added \com\gwt\client to the CLASSPATH and got the same error. I'm not sure what you meant by going up a couple of levels? to add a couple \com to CLASSPATH?

  6. #6
    Join Date
    Jun 1999
    Location
    Eastern Florida
    Posts
    3,877

    Re: Cannot find sysmbol

    The end of the classpath should contain the com\gwt\client folder. That folder should contain the Attending.class file.
    You don't add the package path to the classpath. The classpath points to the location of the package path.
    Given this path: C:\folder1\com\gwt\client\Attendee.class
    with the package: com.gwt.client.
    Then the classpath should be C:\folder1

    going up a couple of levels
    If your current directory is client, you need the classpath to go up to folder1 to be at the start of the package path.
    Norm

  7. #7
    Join Date
    May 2011
    Posts
    4

    Re: Cannot find sysmbol

    That fixed the problem. Thank you very mych for your help Norm.

  8. #8
    Join Date
    Jun 1999
    Location
    Eastern Florida
    Posts
    3,877

    Re: Cannot find sysmbol

    Your welcome. Glad you got it working.
    Norm

  9. #9
    Join Date
    Apr 2011
    Posts
    5

    Re: Cannot find sysmbol

    Definition of Attending is not available if you want then you must write it in same function.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured