简体   繁体   中英

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

第一步

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

第二步

Then find the Java Library file path and click OK

第三步

Finally, click Apply and ok

第四步

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM