How to compile Packages in java
First, navigate to the src directory using terminal. Then execute the command below to compile the People.java.
javac com/amigoscode/people/People.java

Now, to compile the Main.java execute the command below.
javac com/amigoscode/Main.java

This should work fine.

I am new to java , how do I compile packages in Intelij
This is my directory

It is running perfectly in Main.java
To compile , I first ran
javac people/People.java
Then I compile javac Main.java, it returns Main.java:8: error: package com.amigoscode.people does not exist
Main.java
package com.amigoscode;

// Press Shift twice to open the Search Everywhere dialog and type `show whitespaces`,
// then press Enter. You can now see whitespace characters in your code.


import java.util.Scanner;
import com.amigoscode.people.People;


public class Main {

    public static void main(String[] args) {
        People p = new People();
        System.out.println(p.fullName());
    }

}

People.java
package com.amigoscode.people;

public class People {

    public String fname = "John";
    public String lname = "Doe";
    public int age = 24;


    public String fullName() {
        String fullName = fname + " " + lname;
        return fullName;
    }

}

Thank you very much.
