不能在mac上打开.jar文件

时间:2022-10-31 11:52:56

I'm trying to download jsoup on my mac (Mountain Lion). I've downloaded the jsoup.jar file and installed the last java 7 from the site. But here is the problem, when I double click the .jar file it tells to me:

我在我的mac(美洲狮)上下载jsoup。我下载了jsoup。jar文件并从站点安装了最后一个java 7。但问题是,当我双击.jar文件时,它会告诉我:

The Java JAR file “jsoup-1.7.2.jar” could not be launched. Check the console.

Java JAR文件“jsoup-1.7.2”。无法启动jar。检查控制台。

I can't find even the console! Someone can help me? I read a lot of answers about this topic, but they all talk about Java 6 and it has different settings that can't find.

我连控制台都找不到!有人能帮我吗?我读了很多关于这个主题的答案,但是它们都是关于Java 6的,并且它有各种无法找到的设置。

EDIT

编辑

i also tried from the terminal with this command:

我还在终端上尝试了以下命令:

java -jar /Users/Ben/Downloads/jsoup-1.7.2.jar

java jar /用户/本/下载/ jsoup-1.7.2.jar

but it tells me:

但它告诉我:

Failed to load Main-Class manifest attribute from /Users/Ben/Downloads/jsoup-1.7.2.jar

未能从/Users/Ben/Downloads/jsoup-1.7.2.jar加载主类manifest属性

2 个解决方案

#1


0  

I guess you are trying to run the jsoup library as a standalone application assuming it to be an executable jar. All indicates that the jar file you are using is NOT an executable jar hence it wont work.

我猜您正在尝试将jsoup库作为一个独立的应用程序来运行,假设它是一个可执行的jar。所有这些都表明您正在使用的jar文件不是可执行的jar,因此它不能工作。

jsoup.jar is supposed to be used as a java library and you will need to write java code to be able to use the HTML parsing capabilities.

jsoup。jar应该用作java库,需要编写java代码才能使用HTML解析功能。

#2


2  

The JSoup JAR is not executable, so you are not going to be able to 'run' it in any of the ways you described. You are supposed to include it in your project classpath and use classes from it to do your parsing (after importing them of course).

JSoup JAR是不可执行的,所以您将无法以您所描述的任何方式“运行”它。您应该将它包含在项目类路径中,并使用它的类来进行解析(当然是在导入之后)。

You might want to refer to the JSoup Guide for examples on using the library.

您可能想要参考JSoup指南中关于使用库的示例。

#1


0  

I guess you are trying to run the jsoup library as a standalone application assuming it to be an executable jar. All indicates that the jar file you are using is NOT an executable jar hence it wont work.

我猜您正在尝试将jsoup库作为一个独立的应用程序来运行,假设它是一个可执行的jar。所有这些都表明您正在使用的jar文件不是可执行的jar,因此它不能工作。

jsoup.jar is supposed to be used as a java library and you will need to write java code to be able to use the HTML parsing capabilities.

jsoup。jar应该用作java库,需要编写java代码才能使用HTML解析功能。

#2


2  

The JSoup JAR is not executable, so you are not going to be able to 'run' it in any of the ways you described. You are supposed to include it in your project classpath and use classes from it to do your parsing (after importing them of course).

JSoup JAR是不可执行的,所以您将无法以您所描述的任何方式“运行”它。您应该将它包含在项目类路径中,并使用它的类来进行解析(当然是在导入之后)。

You might want to refer to the JSoup Guide for examples on using the library.

您可能想要参考JSoup指南中关于使用库的示例。