0

I am using a 3rd party jar file in my CQ5.6.1 project. A program in the jar uses System.getProperty() to read some property file location.

I am not able to find a way to set these properties for the program to read. Any idea how I can do this in CQ?

seenukarthi
  • 8,241
  • 10
  • 47
  • 68
jpr
  • 185
  • 3
  • 6
  • 20

1 Answers1

0

You can use java options or command line arguments to pass system properties

Java Options

In Windows

set _JAVA_OPTIONS=-Dargument1=value1 -Dargument2=value2

In *nix

export _JAVA_OPTIONS="-Dargument1=value1 -Dargument2=value2"

Command Line

java -jar jarfile.jar -Dargument1=value1 -Dargument2=value2

Then you can get the property value by using System.getProperty()

System.getProperty("argument1")//Will print value1 
System.getProperty("argument2")//Will print value2
seenukarthi
  • 8,241
  • 10
  • 47
  • 68