Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / March 2006

Tip: Looking for answers? Try searching our database.

cannot resolve symbol

Thread view: 
John Smith - 02 Mar 2006 21:33 GMT
I tried:
javac -verbose -g vvs.java

and I got 24 errors of this type:
vvs.java:275: cannot resolve symbol
symbol  : class Entry
location: class com.dt.scenery.vvs
             Entry me = (Entry)VMapping.elementAt(iMappingIndex);
             ^

but Entry.class is in the *same* directory as vvs.java.

note:
vvs.java belongs to
package com.dt.scenery; (line 1 of vvs.java)

and Entry.java belongs to
package com.dt.scenery; (line 1 of Entry.java)

Any suggestion for a fix is appreciated.
zero - 03 Mar 2006 02:24 GMT
"John Smith" <wleung7@gmail.com> wrote in news:1141335221.030238.307960
@i40g2000cwc.googlegroups.com:

> I tried:
> javac -verbose -g vvs.java
[quoted text clipped - 16 lines]
>
> Any suggestion for a fix is appreciated.

Please follow the Java naming conventions.  All classes should start
with a capital letter, and use meaningful words.  "vvs" is not a good
classname.  Following conventions will help you in the long run, trust
me.

You seem to have two problems here:

1. javac doesn't automatically look for class files in the current
directory.  Instead, it looks on the classpath.  Some people prefer to
set the classpath in a system variable, but I find it easier to add it
on the command line (for simple projects anyway)  To specify the current
directory, you use a dot, like this:

javac -cp . vvs.java

2. you're using packages, so instead of looking in the directory listed
on the classpath, javac looks in a subdirectory thereof.  In this case,
it will look in a subdirectory called com/dt/scenery or com\dt\scenery,
depending on your OS.  Make sure the .class file is in this
subdirectory.  You can make javac place it there automatically when
compiling, by using the -d option:

javac -d . Entry.java

Of course this only works if you have the source for Entry, and not just
the class file.

As a final note, I find it easier to compile all source files at once
(again, in simple projects) since this eliminates possible dependency
problems.  I would typically use this command line:

javac -cp .;somejar.jar -d . source/*.java


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.