I have the following directory, let's call it program/
, housing the following items:
Circle.java
Point.java
Shape.java
Triangle.java
Main.java
Geometry/`
All of the .java files are part of the same geometry
package, so I use this command to compile them together:
javac -d Geometry/ Main.java Triangle.java Shape.java Point.java
This puts a .class
file for each of the above files into the directory program/Geometry/geometry
. It also puts those same files into the /program directory, so I guess my first question is why does it put those .class
files in both locations? There doesn't seem to be a point in putting them with the .java
files if they are contained by themselves in the geometry
package directory.
Regardless of the answer to that, my main problem is that I can't seem to get my program to run. Inside Main.java
, there is the Main
class with a main()
function that is supposed to work its magic. I have run the following command in both the program/
and program/Geometry/geometry
with the same error, both listed below:
java Main
Error: Could not find or load main class Main
Can someone explain what I am doing wrong here, and give me an answer to my first question as well? Thank you for any help you can provide!