Skip to content

How can I import a custom package in IntelliJ IDEA (Java)?

There is such term like CLASSPATH which is using that JVM could find custom classes or jar files to import them to another packages (Am I right?). So, I created a few custom classes and placed them into package net.ederika, then I created another project with net.bartikan package name. My main idea is to import classes from net.ederika package to the second project. I specified CLASSPATH environment variable CLASSPATH EV and added to C:/DOC/JavaT net/edeirika/ files with extension .class. I got this: Error with package importing
I used IntelliJ IDEA for this. What’s wrong with my actions? Bruce Eckel (“Thinking in Java” book) wrote that we specify CLASSPATH, add there folders with out .class files and JVM locates it. I’m really frustrated and confused with this topic and can’t merely go on reading that book. From “Thinking in Java” There is no really much info about it on the Internet, thus I ask here. files in CLASSPATH specified folders


IDEA: File > Project Stucture > Libraries > + > Java > Select Library Files > OK > Apply > OK

First, find Preject Structure in a file in the toolbar

Step one

Then click the plus sign, which means to add an external Project Library of your choice, where I am demonstrating the Java Library

Step two

Then find the Java Library file path and click OK

Step three

Finally, click Apply and ok

Step four