xcesco
xcesco

Reputation: 4838

Run a java in jar application with JVM parameter

I'm developing a Java application. When I try to run the packaged version of application with command:

java -Djdk.tls.client.protocols=TLSv1.2 -jar .\target\filesharing-0.0.1-SNAPSHOT.jar

I received the following error:

java.lang.ClassNotFoundException: /tls/client/protocols=TLSv1/2

I'm using OpenJDK11, and I was thinking the syntax was right. What I'm wrong? Thank you in advance.

Upvotes: 0

Views: 412

Answers (1)

stdunbar
stdunbar

Reputation: 17435

For future searchers, Powershell requires command line arguments that contain the period (full stop) character to be quoted. So in this case the command should be:

java "-Djdk.tls.client.protocols=TLSv1.2" -jar .\target\filesharing-0.0.1-SNAPSHOT.jar

Any -D type arguments should be wrapped in double quotes.

In case you're not using Powershell but are instead using cmd wrap just the value of the -D in double quotes:

java -Djdk.tls.client.protocols="TLSv1.2" -jar .\target\filesharing-0.0.1-SNAPSHOT.jar

Upvotes: 2

Related Questions