Campbell Ritchie wrote:There are several ways to compile classes inside packages. This is how I would suggest you do it, working from the parent directory for your packages:-
1: Create folders matching the package names: mkdir packageOne 2: Edit the classes: myEditor packageOne/MyClass.java 3: Save the .java file 4: Compile with javac packageOne/MyClass.java You now have the .java file and the .class file in the same directory, and the CLASSPATH will include your packages by default. As I said, there are other ways to do it.
Dave Tolls wrote:This looks like you have a CLASSPATH environment variable defined.
That would explain why it can't find the other package, even though you are calling javac inside the correct directory.
Campbell Ritchie wrote:Good point: try the -cp . option and see whather that improves things.
It usually does more harm than good to set a system CLASSPATH.
Junilu Lacar wrote:OP was already successful with the -cp . option early on. I think OP was just trying to see if Campbell's suggestion would work for her, too.
Sorry, I missed that.Junilu Lacar wrote:OP was already successful with the -cp . option early on. . . .
Campbell Ritchie wrote:Yes, delete the system CLASSPATH; if you ever need to set a CLASSPATH it will be different for each application, so use the -cp option.
Daniele Barell wrote:
Campbell Ritchie wrote:Yes, delete the system CLASSPATH; if you ever need to set a CLASSPATH it will be different for each application, so use the -cp option.
I will!
Don't get me started about those stupid light bulbs. |