When I create my own package, I get an error saying : "package "x" doesn't exist" when I try to compile. The class can even be in the same directory as main.
The current organization (or lack of) of my program is as follows
MyGame Folder:
class x, class x1, class x2, ... class xn .
So when I do javac *.java it looks in the current directory (MyGame) that contains my main class and finds all the other classes.
I want to add a folder containing classes related to one thing and all the classes in that folder would be in the same package , so it would be:
MyGame Folder:
MyPackage 1:
class p, class p1 ... class pn
class x
Where I could import one of the "p" classes from class x (which would contain main) with a statement like:
import MyGame.MyPackage1.class p;
and can still compile with javac . I want to avoid the use of an IDE before I know how to do it myself.