Results 1 to 6 of 6
- 03-27-2009, 06:39 PM #1
Member
- Join Date
- Mar 2009
- Location
- Kansas City
- Posts
- 4
- Rep Power
- 0
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
- 03-27-2009, 06:52 PM #2
Senior Member
- Join Date
- Aug 2008
- Posts
- 384
- Rep Power
- 5
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
pauseI die a little on the inside...
Every time I get shot.
- 03-27-2009, 06:59 PM #3
Member
- Join Date
- Mar 2009
- Location
- Kansas City
- Posts
- 4
- Rep Power
- 0
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
-
I don't know if this matters here or not, but do your classes use proper package statements?
- 03-27-2009, 07:09 PM #5
Member
- Join Date
- Mar 2009
- Location
- Kansas City
- Posts
- 4
- Rep Power
- 0
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.
- 03-27-2009, 10:28 PM #6
Member
- Join Date
- Dec 2008
- Posts
- 32
- Rep Power
- 0
Similar Threads
-
cannot resolve symbol while using javac
By andi9 in forum New To JavaReplies: 5Last Post: 05-14-2008, 06:50 AM -
Cannot Resolve Symbol error...
By seral1969 in forum New To JavaReplies: 4Last Post: 02-18-2008, 12:17 AM -
Regarding Scanner Object -- Cannot Resolve the Symbol
By pascal45 in forum New To JavaReplies: 1Last Post: 12-21-2007, 11:12 AM -
Error: cannot resolve symbol, help me
By mathias in forum Enterprise JavaBeans (EJB)Replies: 1Last Post: 08-06-2007, 02:46 PM -
MySite/Valid.java:56: cannot resolve symbol
By Albert in forum Enterprise JavaBeans (EJB)Replies: 1Last Post: 07-05-2007, 05:49 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks