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

3

24

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.

Crisp answered 4/6, 2016 at 5:57 Comment(0)
P
48

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?

Psychro answered 6/6, 2017 at 8:50 Comment(0)
C
10

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.

Crisp answered 4/6, 2016 at 5:57 Comment(2)
Thank you so much for your question and answer! this is exactly the same issue i was having and ur answer helped me find the solution.Quartis
Please see @Mike's answer. His answer provides a solution rather than a workaround.Astonishment
A
0

If you are using window powershell please use the following command

java -D"java.library.path"=./DynamoDBLocal_lib -jar DynamoDBLocal.jar -sharedDb
Assort answered 24/4 at 10:36 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.