I'm trying to set up a package that includes some useful things for any card game, such as a Card class, Deck class, etc. Check out the beginning of each class below. Both classes are saved in directory C:/J24work/cardGame. I am receiving compile time errors described below. There are a bunch of other errors as I'm referencing any Card object. I didn't have any problems when I had these classes in the same directory without any package listed. What could be the problem. thanks.
Deck.java:7: cannot find symbol
symbol: class Card
location: class cardGame.Deck
private Card deck;
I have compiled like this on DOS
C:J24work/cardGame>javac Deck.java (errors on this one)
now though I have a BlackJack.java file and BlackJackEvent.java file that don't seem to recognize each other anymore. They are both in the same directory, which is C:\J24work\blackjack and should inherently recognize each other due to default package access. I definitely have the .; in my Classpath set so ??.
Joined: Jan 31, 2006
One more thing. If I compile like this:
C:\J24work\blackjack>javac BlackJack.java or
the only errors are that references to each other aren't recognized, but if I compile like this:
C:\J24work>javac blackjack/BlackJack.java or
I get compile errors stating that package cardGame does not exist. These must all be related to classpath.
I am too tired to give lots of details, I am afraid, but please search through this forum. There is about 1 question a month about compiling with package names, and if you find those questions you will get lots of useful information. Also look at thesetwo sections of the Java Tutorials.