如何在Eclipse和Android Studio中设置类路径 [英] How to set the class path in Eclipse and Android Studio

查看:216
本文介绍了如何在Eclipse和Android Studio中设置类路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我听说您可以使用 classpath 来使用其他库中的类。我搜索了这个,所有结果告诉我使用命令行编译程序并指定类路径。但是现在谁会使用命令行编译java程序?



我正在使用eclipse和Android Studio。我的意思是他们是IDE,所以他们肯定可以很容易地设置类路径,对吗?



另外,我想知道这个上下文中的库这个词只是一个罐子文件,对吗?

解决方案

在Eclipse中:



项目→构建路径→配置构建路径上单击鼠标右键。在Libraries选项卡下,单击 Add Jars或Add External JARs 并给出Jar。



来自



Android Studio:来自

  • 在对话框的左侧面板中,选择

  • 点击面板上方的 + 符号 left - > Java

  • 选择您当地的jar并将其添加到项目中。


  • 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?

    1. Right click on the module in the left hand panel and choose Open Module Settings.
    2. On the left panel of the dialog, choose Libraries.
    3. Click the + sign above the panel second from the left -> Java
    4. Select your local jar and add it to the project.

    这篇关于如何在Eclipse和Android Studio中设置类路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆