如何在 Eclipse 和 Android Studio 中设置类路径 [英] How to set the class path in Eclipse and Android Studio
问题描述
我听说您可以使用 classpath
来使用其他库中的类.我在谷歌上搜索了这个,所有结果都告诉我使用命令行来编译程序并指定一个类路径.但是现在谁会用命令行来编译java程序呢?
我正在使用 Eclipse 和 Android Studio.我的意思是它们是 IDE,所以它们肯定可以很容易地设置类路径,对吗?
另外,我想知道这个上下文中的库"这个词只是一个 jar 文件,对吗?
在 Eclipse 中:
右键单击Project → Build Path → Configure Build Path
.在 Libraries 选项卡下,单击 Add Jars 或 Add External JARs
并提供 Jar.
图片来自
Android Studio: 来自
Libraries
. 左侧第二个面板上方的 +
符号 ->Java
I've heard that you can use classpath
to use classes in other libraries. I googled about this and all results tell me to use the command line to compile the program and specify a classpath. But who would use command line to compile java programs nowadays?
I am using eclipse and Android Studio. I mean they are IDEs so they surely can set the classpath very easily, right?
Also, I want to know the word "library" in this context is just a jar file , right?
In Eclipse:
Right-Click on the Project → Build Path → Configure Build Path
. Under Libraries tab, click Add Jars or Add External JARs
and give the Jar.
Image from link
Android Studio: from Android Studio: Add jar as library?
- Right click on the module in the left hand panel and choose
Open Module Settings
. - On the left panel of the dialog, choose
Libraries
. - Click the
+
sign above the panel second from theleft -> Java
- Select your local jar and add it to the project.
这篇关于如何在 Eclipse 和 Android Studio 中设置类路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!