this is my file tree:
$ tree
.
├── Hi.java
├── com
│ └── libai688
│ ├── User.class
│ └── User.java
this is my Hi.java:
import com.libai688;
public class Hi {
public static void main(String[] args) {
User p1 = new User();
}
}
while I am trying to compile Hi.java
$javac Hi.java
Hi.java:1: error: package com does not exist
import com.libai688;
^
Hi.java:5: error: cannot find symbol
User p1 = new User();
^
symbol: class User
location: class Hi
Hi.java:5: error: cannot find symbol
User p1 = new User();
^
symbol: class User
location: class Hi
3 errors
it throws a long error, I carefully check it with some other project, but I still can not find what is wrong with it.
As I know, in some other language, if you want to import a customized module it should write a relative path. But in Java, I am confused with how to import a third-party module or a customized muddle.
This is my User.java
package com.libai688;
public class User{
public String name;
public int age;
public User(String name, int age){
this.name = name;
this.age = age;
}
}