Results 1 to 6 of 6
  1. #1
    Gabinka is offline Member
    Join Date
    Mar 2009
    Location
    Kansas City
    Posts
    4
    Rep Power
    0

    Default Yet another Cannot Resolve Symbol

    Hi, folks. I'm just at the beginning stages of learning Java, using a book: Java and XML: Your visual blueprint for creating Java-enhanced Web programs.

    It's got a nice layout: some info at the top of the page, examples of text editors with code or command prompt with commands on the bottom.

    I'm on Chapter 3, where I created an object (AuthorInformation) and it complied fine after I changed the Class to class on the very first word.

    Then the book has me "instantiate" the object. It says to create a standalone program that instantiates the object.

    So I follow that code precisely in my text editor.

    This is what my first object looks like in code:

    class AuthorInformation {
    String EmailAddress() {
    String message = "xxxxxxx@gmail.com";
    return message;
    }
    }

    Then my second, following exactly allong with the book:

    class go {
    public static void main(String[] args) {
    AuthorInformation object1 = new AuthorInformation();
    System.out.println(object1.EmailAddress());
    }

    }

    Both of these are in the same directory on my computer (BookPractice). As I mentioned the first compiled fine (AuthorInformation.class). The second (go.java) will not. Javac constantly says Cannot resolve symbol and points to the capital A of AuthorInformation in both places it's used.

    I've done the -classpath thing, though I don't quite get it. I have put the j2sdk1.4.0 path in my computer's path. So javac is in J:\Programming\j2sdk1.4.0\bin and I use javac j:\workspace\BookPractice\go.java as my command and get the above error.

    I've checked and double-checked. It's just like the book shows. I've done javac -classpath .;J:\workspace\*.java;j:\workspace\BookPractice\*. java

    What am I doing wrong? I'd really like to get past this so that I can move on with learning.

    Do I need to put my files in a separate folder structure? Is this book just too outdated so that I need slightly different code? I could really use a coach here.

    Thanks

  2. #2
    Supamagier is offline Senior Member
    Join Date
    Aug 2008
    Posts
    384
    Rep Power
    6

    Default

    works fine for me.

    I suppose you use and outdated version of the JDK, download a new one ^_^
    1.6.0_10 is what I have, and mine already is outdated :p

    Anyway, I don't know what code you use to compile+run, but I use this:
    @echo off
    "C:\Program Files\Java\jdk1.6.0_10\bin\javac" *.java
    java go
    pause
    I die a little on the inside...
    Every time I get shot.

  3. #3
    Gabinka is offline Member
    Join Date
    Mar 2009
    Location
    Kansas City
    Posts
    4
    Rep Power
    0

    Default

    I'm not doing compile+run, just compile. I'll try and run it once I know it compiles.

    I will download a newer JDK if someone will let me know which one. There's Java SE, Jave EE.... etc. Send me a link to a specific download and I'll be glad to download it.

    Thanks

  4. #4
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    25

    Default

    I don't know if this matters here or not, but do your classes use proper package statements?

  5. #5
    Gabinka is offline Member
    Join Date
    Mar 2009
    Location
    Kansas City
    Posts
    4
    Rep Power
    0

    Default

    I have no idea. I'm really at the beginning of this. I typed exactly what they put in the book. Then say say compile. I try and I get an error.

    I don't even know what proper package statements are.

  6. #6
    tomiu is offline Member
    Join Date
    Dec 2008
    Posts
    32
    Rep Power
    0

    Default

    ok the problem is with ur classpath....enter this:

    Java Code:
    javac -classpath . j:\workspace\BookPractice\*.java
    edit: install new version of JDK to avoid this problems
    Last edited by tomiu; 03-27-2009 at 11:10 PM.

Similar Threads

  1. cannot resolve symbol while using javac
    By andi9 in forum New To Java
    Replies: 5
    Last Post: 05-14-2008, 06:50 AM
  2. Cannot Resolve Symbol error...
    By seral1969 in forum New To Java
    Replies: 4
    Last Post: 02-18-2008, 12:17 AM
  3. Replies: 1
    Last Post: 12-21-2007, 11:12 AM
  4. Error: cannot resolve symbol, help me
    By mathias in forum Enterprise JavaBeans (EJB)
    Replies: 1
    Last Post: 08-06-2007, 02:46 PM
  5. MySite/Valid.java:56: cannot resolve symbol
    By Albert in forum Enterprise JavaBeans (EJB)
    Replies: 1
    Last Post: 07-05-2007, 05:49 AM

Posting Permissions

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