如何在IntelliJ IDEA中导入自定义包(Java)?

huangapple go评论116阅读模式
英文:

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

问题

有一个叫做CLASSPATH的术语,它用于让JVM找到自定义类或jar文件并将它们导入到其他包中(我理解正确吗?)。所以,我创建了一些自定义类并将它们放到了net.ederika包中,然后我创建了另一个项目,命名为net.bartikan包。我的主要想法是将net.ederika包中的类导入到第二个项目中。我指定了CLASSPATH环境变量CLASSPATH EV,并将带有扩展名.class的文件添加到C:/DOC/JavaT net/edeirika/文件夹中。我得到了这个错误:导入包时的错误
我在这个过程中使用了IntelliJ IDEA。我的操作有什么问题吗?Bruce Eckel(《Java编程思想》一书的作者)写道,我们要指定CLASSPATH,然后将不带.class扩展名的文件夹添加到其中,JVM就会找到它们。我对这个主题感到非常沮丧和困惑,无法继续阅读那本书。来自《Java编程思想》。在互联网上关于这个问题的信息真的不多,因此我在这里提问。CLASSPATH指定的文件夹中的文件

英文:

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

答案1

得分: 0

IDEA: 文件 > 项目结构 > 库 > + > Java > 选择库文件 > 确定 > 应用 > 确定

<h3>首先,在工具栏中找到“项目结构”</h3>

如何在IntelliJ IDEA中导入自定义包(Java)?

<h3>然后点击加号,表示添加您选择的外部项目库,我演示的是Java库</h3>

如何在IntelliJ IDEA中导入自定义包(Java)?

<h3>然后找到Java库文件路径,然后点击确定</h3>

如何在IntelliJ IDEA中导入自定义包(Java)?

<h3>最后,点击应用和确定</h3>

如何在IntelliJ IDEA中导入自定义包(Java)?

英文:

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

<h3>First, find Preject Structure in a file in the toolbar</h3>

如何在IntelliJ IDEA中导入自定义包(Java)?

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

如何在IntelliJ IDEA中导入自定义包(Java)?

<h3>Then find the Java Library file path and click OK</h3>

如何在IntelliJ IDEA中导入自定义包(Java)?

<h3>Finally, click Apply and ok</h3>

如何在IntelliJ IDEA中导入自定义包(Java)?

huangapple
  • 本文由 发表于 2020年7月22日 16:52:20
  • 转载请务必保留本文链接:https://go.coder-hub.com/63030422.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定