Retrieving command line -D options in Java

110 Views Asked by At

I have clean integration-test -DclassId=appas a maven goal in a Jenkins Maven Job.

How can I retrieve this in Java using System.getenv();? When I do this I am only seeing null.

1

There are 1 best solutions below

0
On BEST ANSWER

For command line options you have to use System.getProperty() instead of System.getenv():

String id = System.getProperty("classId");

Find more details here.