Where the java compiler saves its import mapping

I am new to java. I want to know when I am writing

import {SOME_PACKAGE_NAME}

where is he looking for a folder? Is there a shared folder or mapping file where it is looking for this package?

+4
source share
2 answers

All directories of your project and Jar will be added to the class path. From there, classes from are imported classpath.

You will see errors if the compiler did not find them at compile time.

If they are not found at runtime ClassNotFoundException's/NoClassDefFoundError, depending on the case.

+5
source

Java , require . ; : . :

new java.util.ArrayList<>();

java.util.ArrayList - , JRE, JAR, , , .java.

, , : Java EE Java EE , , .

+3

Source: https://habr.com/ru/post/1605963/


All Articles