如何在Eclipse和Android Studio中设置类路径 [英] How to set the class path in Eclipse and Android Studio
问题描述
我听说您可以使用 classpath
来使用其他库中的类。我搜索了这个,所有结果告诉我使用命令行编译程序并指定类路径。但是现在谁会使用命令行编译java程序?
我正在使用eclipse和Android Studio。我的意思是他们是IDE,所以他们肯定可以很容易地设置类路径,对吗?
另外,我想知道这个上下文中的库这个词只是一个罐子文件,对吗?
在Eclipse中:
在项目→构建路径→配置构建路径
上单击鼠标右键。在Libraries选项卡下,单击 Add Jars或Add External JARs
并给出Jar。
来自
Android Studio:来自
库
。 +
符号 left - > 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屋!