problem compiling with packages
I have two classes. Class A and class B. Class B uses class A in its code. Both compile normally.
However, if I add the following to each class at the top
package myPackage;
Copy both of the classes a directory called 'myPackage' and recompile, it fails. I can compile them both in the myPackage directory if I leave off the 'package' tag.
[368 byte] By [
gramberto] at [2007-9-30 22:21:06]

Please read the docs for javac.exe so you can learn how to compile properly.
Here's what you should do:
(1) Put A.java and B.java in a directory called myPackage.
(2) Open a command shell and navigate to the parent of myPackage.
(3) Issue this command to compile:
javac -d . -classpath . myPackage\*.java
Note the "dot" after -d and -classpath. Add any 3rd party JARs that you need after the "dot", separated by semi-colons.
You should see A.class and B.class in the myPackage directory.
To run, type:
java -classpath . myPackage.A
where A is the name of the class with the main method that you want to run.
%