I'm trying to import Bar.java into Foo.java, where my directory is structured like this:
.
└─bar
└─Bar.java
└─foo
└─Foo.java
So I create Bar.java:
package bar;
public class Bar {}
and Foo.java:
import bar.Bar;
public class Foo {}
I run javac from the foo directory:
javac Foo.java -cp ../bar
and receive the error:
Foo.java:1: error: package bar does not exist
My understanding was that the -cp option should be used to point towards the required class (Bar.java). Could someone shed some light on what I'm doing wrong?