AppletTalk.com Forum Index AppletTalk.com
Java discussions newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Newbie Compiling Question

 
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Java Help
View previous topic :: View next topic  
Author Message
Tim Mierzejewski
Guest





PostPosted: Tue May 25, 2004 5:16 pm    Post subject: Newbie Compiling Question Reply with quote



Alright, I have a public clas CarObject taken right out of the Java book I'm
learning from, starts with "public class CarObject {" as the first line, and
that's in CarObject.java. I javac'd that file. The main function is in
another class, CarTest3, which creates instances of CarObject:

public class CarTest3 {
public static void main( String[] args ) {
CarObject car = new CarObject (CarObject.V10);
// ...
}
}

So I tried to "javac" that file, CarTest3.java, in the same folder as the
CarObject.java file, and I got the error "cannot resolve symbol" for each
time I mentioned CarObject in CarTest3.java. So, I decided to put the entire
CarObject class into CarTest3.java. I tried compiling that, and I got a fun
error, "class CarObject is public, should be declared in a file called
CarObject.java".
Really, a file called CarObject.java. What a novel idea.

In any case, what am I doing wrong?
Thanks,
Tim


Back to top
Andrew Thompson
Guest





PostPosted: Tue May 25, 2004 5:31 pm    Post subject: Re: Newbie Compiling Question Reply with quote



On Tue, 25 May 2004 17:16:29 GMT, Tim Mierzejewski wrote:

Quote:
...I got the error "cannot resolve symbol"

See if this throws any light on it
<http://mindprod.com/jgloss/errormessages.html#CANNNOTRESOLVESYMBOL>

I suspect it is because you are not using
packages, or not adding the current
directory to the classpath at compile time.

javac -classpath . *.java

Also check..
<http://www.physci.org/codes/javafaq.jsp#exact>

--
Andrew Thompson
http://www.PhySci.org/ Open-source software suite
http://www.PhySci.org/codes/ Web & IT Help
http://www.1point1C.org/ Science & Technology

Back to top
Tim Mierzejewski
Guest





PostPosted: Tue May 25, 2004 5:51 pm    Post subject: Re: Newbie Compiling Question Reply with quote



Thanks. My book made no mention of the -classpath tag or how to use it, but
now it works. Muchas gracias.

Tim


Back to top
Andrew Thompson
Guest





PostPosted: Tue May 25, 2004 6:03 pm    Post subject: Re: Newbie Compiling Question Reply with quote

On Tue, 25 May 2004 17:51:30 GMT, Tim Mierzejewski wrote:

Quote:
Thanks. My book made no mention of the -classpath tag or how to use it, but
now it works.

I think you will love this then..
<http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/javac.html#options>

Quote:
..Muchas gracias.

You are welcome.

--
Andrew Thompson
http://www.PhySci.org/ Open-source software suite
http://www.PhySci.org/codes/ Web & IT Help
http://www.1point1C.org/ Science & Technology

Back to top
Andrew Thompson
Guest





PostPosted: Tue May 25, 2004 7:07 pm    Post subject: Re: Newbie Compiling Question Reply with quote

On Tue, 25 May 2004 17:31:44 GMT, Andrew Thompson wrote:

Quote:
See if this throws any light on it
http://mindprod.com/jgloss/errormessages.html#CANNNOTRESOLVESYMBOL

(chuckles) Roedy, ..no wonder I was
having so much trouble guessing
your anchor names!

Were you very cold when you
wrote that one? ;-)

--
Andrew Thompson
http://www.PhySci.org/ Open-source software suite
http://www.PhySci.org/codes/ Web & IT Help
http://www.1point1C.org/ Science & Technology

Back to top
Roedy Green
Guest





PostPosted: Tue May 25, 2004 7:41 pm    Post subject: Re: Newbie Compiling Question Reply with quote

On Tue, 25 May 2004 19:07:22 GMT, Andrew Thompson
<SeeMySites (AT) www (DOT) invalid> wrote or quoted :

Quote:
http://mindprod.com/jgloss/errormessages.html#CANNNOTRESOLVESYMBOL

now fixed:
<http://mindprod.com/jgloss/errormessages.html#CANNOTRESOLVESYMBOL>
--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.

Back to top
Display posts from previous:   
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Java Help All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.