Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

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.

like image 813
Ron Avatar asked Jun 04 '16 05:06

Ron


People also ask

Could not find or load main class main?

When you get the message "Could not find or load main class ...", that means that the first step has failed. The java command was not able to find the class. And indeed, the "..." in the message will be the fully qualified class name that java is looking for.

Could not find or load main class Hello HelloWorld?

Wrong Class Name And it failed with the error “Could not find or load main class helloworld.” As discussed earlier, the compiler will generate the . class file with the exact same name given to the Java class in the program. So in our case, the main class will have the name HelloWorld, not helloworld.


1 Answers

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?

like image 138
Mike Smith Avatar answered Sep 24 '22 07:09

Mike Smith