Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Run DynamoDB Local with the java command on Mac OS X

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

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

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

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

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

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

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


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.

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

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

I fixed it like that:

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

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

like image 370
Yves M. Avatar asked Jul 22 '14 17:07

Yves M.


People also ask

How do I start DynamoDB locally?

The application doesn't run on earlier JRE versions. After you download the archive, extract the contents and copy the extracted directory to a location of your choice. To start DynamoDB on your computer, open a command prompt window, navigate to the directory where you extracted DynamoDBLocal.

Is DynamoDB written in Java?

There is a development version known as DynamoDB Local used to run on developer laptops written in Java, but the cloud-native database architecture is proprietary closed-source.

Can I install DynamoDB locally?

DynamoDB Local is available as a download (requires JRE), as an Apache Maven dependency, or as a Docker image. If you prefer to use the Amazon DynamoDB web service instead, see Setting up DynamoDB (web service).

How do I run DynamoDB locally with different ports?

DynamoDB Local listens on port 8000 by default; you can change this by specifying the –port option when you start it. If you are using the default port, the local endpoint will be localhost:8000.


2 Answers

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

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

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

like image 51
Swapnil Avatar answered Sep 21 '22 01:09

Swapnil


For Mac, it might work without -Djava.library.path option. Try the following command:

java -jar DynamoDBLocal.jar

Also, the link to the download in the blog does not point to the latest DynamoDB Local version. You can get the latest version from here. This link is also present in the AWS Documentation.

Thanks.

like image 44
Aanchal Gupta Avatar answered Sep 19 '22 01:09

Aanchal Gupta