7

我下载了一个 jar 文件,它会自动保存到我的下载文件夹中(我使用的是 mac osx 山狮)。当我点击它时,它会自动启动,一切都很好。

但是,当我将包含 jar 文件和其他一些文件的文件夹移动到另一个目录(是的,我想清理我的下载文件夹)时,我无法启动 jar 文件。我总是得到错误:

The Java JAR file "example.jar" could not be launched.
Check the Console for possible error messages.

我能做些什么来解决这个问题?

编辑:当我尝试通过控制台启动 jar 文件时,我收到此错误:

Unable to access jarfile ./example.jar
4

3 回答 3

13

It's probably the case that the JAR was downloaded along with other directory/files. So it's possible that some files are missing when you try to run the application.

Try opening a terminal and run:

$ java -jar name.jar

Where name.jar is your JAR file.

于 2013-01-21T15:13:08.817 回答
1

我有同样的问题,我通过使 jar 文件可执行来修复它,例如

 $ chmod +x blah.jar
于 2013-09-06T03:51:44.513 回答
0

正如@Pablo 提到的,这可能是因为您有一些其他文件/目录与 jar 一起下载,当您将 jar 移动到单独的目录时,您没有复制这些文件/目录。为了解决这个问题,您可能想尝试将 jar(以及任何其他文件/目录等)直接下载到您想要的文件夹,然后启动 jar,这样您就不会错过启动所需的任何内容。

于 2013-09-06T05:10:46.047 回答