Reputation: 3087
I am trying to compile Board.java, which is in the same package (and directory) as Hexagon.java, but I get this error:
Board.java:12: cannot find symbol
symbol : class Hexagon
location: class oadams_atroche.Board
private Hexagon[][] tiles;
The first few lines of Board.java:
package oadams_atroche;
import java.util.LinkedList;
import java.util.Queue;
import java.io.PrintStream;
import p323.hex.*;
public class Board implements Piece{
>---//Fields
>---private int n;
>---private Hexagon[][] tiles;
The first few lines of Hexagon.java:
package oadams_atroche;
import p323.hex.*;
public class Hexagon implements Piece{
I just cannot see what I am doing wrong. Any ideas?
Thanks
Upvotes: 29
Views: 44633
Reputation: 99
Not sure about different platforms, but using Netbeans on Windows, it's often easiest to just create a project.
If you're trying to compile from command line:
javac -cp . *.java
Upvotes: -1
Reputation: 6594
It works for me:
cd SRC_DIRECTORY
javac -cp . PACKAGE/CLASS.java
Upvotes: 0
Reputation: 421290
I'm quite sure you're compiling from within the wrong directory. You should compile from the source root-directory, and not from within the oadams_atroches directory.
Have a look at this bash-session:
aioobe@r60:~/tmp/hex/oadams_atroche$ ls
Board.java Hexagon.java
aioobe@r60:~/tmp/hex/oadams_atroche$ javac Board.java
Board.java:12: cannot find symbol
symbol : class Hexagon
location: class oadams_atroche.Board
private Hexagon[][] tiles;
^
1 error
While if I go up one directory...
aioobe@r60:~/tmp/hex/oadams_atroche$ cd ..
... and compile:
aioobe@r60:~/tmp/hex$ javac oadams_atroche/Board.java
aioobe@r60:~/tmp/hex$
Upvotes: 43