"error: cannot find symbol" while compiling java project using makefile

I have a simple java project with 4 java classes. I am trying to compile it using make for research purpose. All java files are placed under Test/MyProj directory and makefile is also there. Below is my makefile -

JFLAGS = -g -cp .
JC = javac
.SUFFIXES: .java .class
.java.class:
	$(JC) $(JFLAGS) $*.java

CLASSES = \
	Way.java \
	Sport.java \
	SportTester.java \
	Area.java 

default: classes

classes: $(CLASSES:.java=.class)

%.class : %.java
	$(JC) $(JFLAGS) $<

clean:
	$(RM) *.class

Open in new window


This is the error I am getting after running make. I have set javac correctly in PATH variable. If I run javac *.java from the same command prompt it works fine. What could be the problem?

C:\Test\MyProj>make
javac -g -cp . Way.java
javac -g -cp . Sport.java
Sport.java:10: error: cannot find symbol
        private Place currPlace;
                ^
  symbol:   class Area
  location: class Sport
Sport.java:11: error: cannot find symbol
        private Vector<Area> vecAreas;
                       ^
  symbol:   class Area
  location: class Sport
Sport.java:52: error: cannot find symbol
        void setCurrArea(Area p) {
                          ^
  symbol:   class Area
  location: class Sport
Sport.java:15: error: cannot find symbol
                vecAreas = new Vector<Area>();
                                       ^
  symbol:   class Area
  location: class Sport
Sport.java:16: error: cannot find symbol
                currArea = new Area("Andheri");
                                ^
  symbol:   class Area
  location: class Sport
Sport.java:27: error: cannot find symbol
        Iterator<Area> itr = vecAreas.iterator();
                 ^
  symbol:   class Area
  location: class Sport
Sport.java:45: error: cannot find symbol
                Area pl = new Area(p);
                ^
  symbol:   class Area
  location: class Sport
Sport.java:45: error: cannot find symbol
                Area pl = new Area(p);
                               ^
  symbol:   class Area
  location: class Sport
8 errors
make: *** [Sport.class] Error 1

Open in new window

James BondSoftware ProfessionalAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

CEHJCommented:
The Java compiler can also be more efficient by caching the compiled results of other classes while compiling further classes that depend on the results of ones already compiled. This sort of automatic dependency evaluation is not really possible with make alone.

from THIS
You have dependency problems probably because they are being compiled in the wrong order. A glob might be better but make is the wrong tool for the job
0
James BondSoftware ProfessionalAuthor Commented:
I changed makefile as below and it worked.

%.class : %.java
      $(JC) $(JFLAGS) *.java
0
James BondSoftware ProfessionalAuthor Commented:
I changed makefile as below and it worked.

%.class : %.java
      $(JC) $(JFLAGS) *.java
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

CEHJCommented:
... which is what i suggested:
A glob might be better
0
James BondSoftware ProfessionalAuthor Commented:
Sorry. I missed that part in your reply. Have indicated your reply as a solution now. Appreciate your help.
0
CEHJCommented:
np :)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Eclipse

From novice to tech pro — start learning today.