在 Mac OS X 上使用 java 命令运行 DynamoDB Local

我正在尝试在 MAC 上本地运行 DynamoDB.亚马逊官方博客说我必须下载jar文件并运行以下命令:

I'm trying to run DynamoDB local on a MAC. The Amazon official blog says I have to download the jar file and run the following command:

$ java –Djava.library.path=. -jar DynamoDBLocal.jar

但我在 MAC OS X 终端上收到以下错误:

But I got the following error on MAC OS X terminal:

错误:无法找到或加载主类 –Djava.library.path=.

Error: Could not find or load main class –Djava.library.path=.

哇?该命令接缝无法识别 -D 参数..为什么?

Wut? The command seams not to recognise the -D parameter.. why?

我也在使用 Linux (Fedora),我从来没有遇到过任何问题.

I'm also working on Linux (Fedora) and I never had any problem with it.

在 MAC OS X 上,java -version 给我 java version "1.8.0_11"

On MAC OS X, java -version gives me java version "1.8.0_11"

可能是什么问题?(我对java命令了解不多)

What could be the problem? (I don't know that much with java commands)

编辑1:感谢@Swapnil,我们可以注意到亚马逊博客上有一个拼写错误,他们使用了错误的破折号(-D 参数的 fileformat.info/info/unicode/char/2013/index.htm" rel="noreferrer">EN DASH unicode U+2013).请注意,亚马逊文档(不是博客)没有拼写错误,也指 最新二进制.

Edit 1: Thanks to @Swapnil, we can notice that there is a typo error on the Amazon blog, they used a wrong dash character (EN DASH unicode U+2013) for the -D argument. Note that the Amazon documentation (not the blog) does not have the typo error and also refers to an up-to-date binary.

编辑 2:使用正确的破折号,参数由 java 解释,但在运行时我仍然收到(不同的)错误消息:

Edit 2: With the correct dash, the argument is interpreted by java, but I still got a (different) error message during runtime:

严重:[sqlite] SQLiteQueue[AKID_eu-west-1.db]:错误运行作业队列 com.almworks.sqlite4java.SQLiteException:[-91] 无法加载库:java.lang.UnsatisfiedLinkError:没有 sqlite4java-osx-x86_64 在java.library.path

SEVERE: [sqlite] SQLiteQueue[AKID_eu-west-1.db]: error running job queue com.almworks.sqlite4java.SQLiteException: [-91] cannot load library: java.lang.UnsatisfiedLinkError: no sqlite4java-osx-x86_64 in java.library.path

我是这样解决的:

java -Djava.library.path=./DynamoDBLocal_lib/  -jar DynamoDBLocal.jar

现在终于可以工作了……亚马逊文档有一些问题……

It's now finally working... Amazon documentation have some problems..

推荐答案

以下内容似乎适用于我的 Mac OS X -

The below seems to work for me on my Mac OS X -

java -Djava.library.path=. -jar your_jar 

嗯,您在 –D 中使用的破折号字符似乎完全是一个不同的字符.这可能是导致问题的原因.

Well, the dash character you've used in –D seems to be a different character altogether. That's probably causing the problem.

相关文章