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

查看:38
本文介绍了如何在 Eclipse 和 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
  • 选择您的本地 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天全站免登陆