Java 安装 JAR 文件

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/19632560/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-12 18:58:34  来源:igfitidea点击:

Installing a JAR file

javajarinstalljsoup

提问by Marco

I've just downloaded Jsoup from http://jsoup.org/download(jsoup-1.7.2.jar). The question is simple: how do I install it? I've already tried with right click > open with > C:\Program Files\Java\jre7\bin\javaw.exe after installing the latest JRE version but it doesn't work. The jar file is on my desktop and I currently use WIN7. Some step-by-step "instruction" would be appreciated!

我刚刚从http://jsoup.org/download(jsoup-1.7.2.jar)下载了 Jsoup 。问题很简单:我如何安装它?在安装最新的 JRE 版本后,我已经尝试过右键单击 > 打开 > C:\Program Files\Java\jre7\bin\javaw.exe 但它不起作用。jar 文件在我的桌面上,我目前使用 WIN7。一些分步“说明”将不胜感激!

回答by ben75

From the jsoup web site:

jsoup 网站

jsoup is a Java library for working with real-world HTML. It provides a very convenient API for extracting and manipulating data, using the best of DOM, CSS, and jquery-like methods.

jsoup 是一个用于处理真实世界 HTML 的 Java 库。它提供了一个非常方便的 API 来提取和操作数据,使用最好的 DOM、CSS 和类似 jquery 的方法。

It means that jsoup is not a standalone java app. It's a library providing services that can be use/embedded in some other application.

这意味着 jsoup 不是独立的 Java 应用程序。它是一个提供可以在其他应用程序中使用/嵌入的服务的库。

So to use it, you have to add it to the classpath of your application and then you will be able to call some of it's API methods to perform the required job.

因此,要使用它,您必须将它添加到应用程序的类路径中,然后您将能够调用它的一些 API 方法来执行所需的工作。

Note that there is an online demo of jsoup capabilities here.

注意,这里的jsoup能力的在线演示在这里

回答by Alexmelyon

Just include this jar into your project

只需将此 jar 包含到您的项目中

For Eclipse:
1. Right click on your project
2. properties
3. Java Build Path
4. Add external jars
5. Find your JAR
6. OK, OK, OK

对于 Eclipse:
1. 右键单击​​您的项目
2. 属性
3. Java 构建路径
4. 添加外部 jar
5. 找到您的 JAR
6. 好,好,好

For IntelliJ IDEA:
1. File
2. Project structure
3. Libraries
4. "+" at the top of center colon
5. Java
6. OK, OK, OK

对于 IntelliJ IDEA:
1. 文件
2. 项目结构
3. 库
4. 中间冒号顶部的“+”
5. Java
6. OK, OK, OK

And read docs for this library.

并阅读此库的文档。

回答by Chitii Ran

For Eclipse Mars:

对于日食火星:

  1. Right click on your project
  2. properties
  3. Java Build Path
  4. Choose the library tab
  5. Add external jars
  6. Find your JAR
  7. Apply and OK
  1. 右键单击您的项目
  2. 特性
  3. Java 构建路径
  4. 选择库选项卡
  5. 添加外部罐子
  6. 找到你的 JAR
  7. 申请并确定

Modification from Alexmelyon

来自 Alexmelyon 的修改