I have a class called ProgA
public class ProgA
public static void main(String args)
ProgB pb = new ProgB();
public class ProgB
public void callMe()
javac -cp C:\Users\MyName\Desktop\test2 ProgA.java
In order to use a class from another package, you need to either use the fully qualified class name, or have an
import statement. This is a
.java source code requirement. It can't be fixed simply by fiddling with the compiler's classpath.
Without an import statement, unqualified names are assumed to belong to the current source file's package. If you're in a
package test file, the identifier
ProgB will match
test.ProgB but not
test2.ProgB. The compiler won't search other packages unless you tell it to.