Be ensure that the package folder mypackage
and Main.class
share the parent folder.
package mypackage;
public class Child {}
I presume that the Main
class is created in default
package.
public class Main {
public static void main(String []args){
mypackage.Child child=new mypackage.Child();
}
}
and your directory structure should be:
main-directory/
|
|----/mypackage/
Child.class
|
| Main.class
| Main.java
| Child.java
and to launch/load the Main
issue following command,
java Main