First, To compile the java source file using
javac you need to specify the files to compile explicitly.
you need not provide the
path if the source file is in the current working directory.
Second, whenever java encounters
import abc.xyz.ClassName; it tries to resolve
abc/xyz/ClassName with respect to the
classpath or current working directory.
So if you are inside the vehicles folder and compile your code, it wont compile because it will look for folder vehicles inside folder vehicles (which doesn’t exist!).
but, you can do this when inside the vehicles folder
javac -cp ../ BicycleMain.java
and it should compile, because classpath will be set to the directory(
../) containing vehicles. which will resolve your
and then use
java -cp ../ vehicles/BicycleMain to run.