javac fails with symbol not found

Here is my folder structure:

- myGame/
  - bin/
  - src/
     - common/
     - logic/
     - main/
     - messageprotocol/
     - test/
     - util/
         - Test.java
         - Rectangle.java
         - Geometry.java

I would like to compile Test.java which is in util package. However, I get symbol not found errors, I guess javac command is wrong. Also, you should know that Test.java has references to other classes within the same project (myGame).

Here is what I do:

cd myGame/
javac -d bin -classpath bin src/util/Test.java

Once I'm done with above, I'd do this and it would work (I hope):

cd myGame/bin
java Test

I have read a lot of resources and tried to apply but it didn't work for my folder structure. What am I doing wrong?

Edit: Errors I receive are:

myGame/src/util/Test.java:16: cannot find symbol
symbol  : class Rectangle
location: class util.Test
  private static final Rectangle[] rectangles = new Rectangle[someNumber];
                       ^
myGame/src/util/Test.java:16: cannot find symbol
symbol  : class Rectangle
location: class util.Test
  private static final Rectangle[] rectangles = new Rectangle[someNumber];
                                                          ^
myGame/src/util/Test.java:20: cannot find symbol
symbol  : variable Geometry
location: class util.Test
    System.out.println("Printing " + Geometry.NUMBER);
                                                      ^
myGame/src/util/Test.java:24: cannot find symbol
symbol  : variable Geometry
location: class util.Test
      serverSocket = new Circle(Geometry.NUMBER);
                                      ^
myGame/src/util/Test.java:36: cannot find symbol
symbol  : class Rectangle
location: class util.Test
            rectangles[i] = new Rectangle(number, rectangles);
                                   ^
5 errors

Answers


Package structure for your Test.java is util.Test so you should do:

cd myGame/src
javac -d ../bin -classpath ../bin util/Test.java

and then try running it. hope this helps.


Need Your Help

How to get range of hour using awk?

bash awk sed grep

I want to extract data with intervals of 1 hour in my log file. Here is my variables:

Reading itunes XML file with PHP DOM method

php xml parsing xml-parsing itunes

I'm having some trouble in getting information from my itunes XML feed which you can peek at here: http://c3carlingford.org.au/podcast/C3CiTunesFeed.xml