Ron
Ron

Reputation: 1161

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

I am trying to run DynamoDB locally, with the instructions here:

http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DynamoDBLocal.html

I've downloaded the zip file, and unzipped everything into a folder.

I'm on Windows 10.

In Powershell, in that directory when I run:
java -Djava.library.path=./DynamoDBLocal_lib -jar DynamoDBLocal.jar -sharedDb

I get:

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

I've read this which is very similar - closest I could find but it didn't help: java.lang.UnsatisfiedLinkError: no sqljdbc_auth in java.library.path

I don't think the issue is that it cannot find the class, it is that it doesn't know what library.path means.

I have java installed:
C:\Dynamo> java -version java version "1.8.0_91" Java(TM) SE Runtime Environment (build 1.8.0_91-b15) Java HotSpot(TM) Client VM (build 25.91-b15, mixed mode)

In my PATH I have C:\ProgramData\Oracle\Java\javapath which I think is correct.

Do I need the JDK? not just JRE? Am I doing something else wrong?

I think that the path in the example may not be correct for windows, but I don't think that is the problem, I have tried dozens of different paths, but they all say the same thing.

Upvotes: 24

Views: 9348

Answers (3)

GARVIT BHARDWAJ
GARVIT BHARDWAJ

Reputation: 1

If you are using window powershell please use the following command

java -D"java.library.path"=./DynamoDBLocal_lib -jar DynamoDBLocal.jar -sharedDb

Upvotes: 0

Michael Smith
Michael Smith

Reputation: 732

We found that PowerShell misinterprets the -Djava.library.path parameter. Enclosing either the parameter name or the entire name & value fixed the issue in our case.

java -D"java.library.path"=./DynamoDBLocal_lib -jar DynamoDBLocal.jar -sharedDb

or

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

The answers to this question also helped How to pass Properties to jar from Powershell?

Upvotes: 48

Ron
Ron

Reputation: 1161

Tried one last time before posting the question, this time with just a normal command prompt rather than powershell and it works. The path in the example worked fine.

Upvotes: 10

Related Questions