0

so, I've written 3 simple classes in 3 different class files: Point.java, Rectangle.java, Circle.java,

and a main class named main.java. they are all in the same folder name shapes.

the main class just have a main function that declare each of these shapes and print them.

all the files are in this path: ~/Downloads/myProject/src/shapes/

can someone please help me with the specific command i should write to compile this main class?

note that when i use this command: javac -cp src/shapes src/shapes/main.java the compiler returns errors like this:

src/shape/main.java:7: error: cannot find symbol Point p1 = new Point(1.5, 2); ^ symbol: class Point location: class main

for each shape i declared...

Soren
  • 13,623
  • 4
  • 34
  • 66
  • Do you have a package declaration in the classes? Or are they all in the default package? – Jorn Vernee May 06 '16 at 19:25
  • It may help if you add the source code to reproduce your problem -- head [this](http://stackoverflow.com/help/mcve) section of the help pages – Soren May 06 '16 at 19:29

2 Answers2

0
javac Point.java
javac Rectangle.java
javac Circle.java
javac main.java

Simply compile them in the correct order: Point is used in Rectangle and Circle (I imagine), so compile it before the others.

Remember that in Java class name should always be title case (AKA: Main.java, not main.java).

Lorenzo Barbagli
  • 1,223
  • 15
  • 33
0

javac option to compile all java files under a given directory recursively

Community
  • 1
  • 1
Kiryl
  • 111
  • 4