0 votes
1 view
in Java by (9.2k points)

Below is the example code where I want to pass custom options to run  compiled java code from command-line: 

java --output-dir "output_dir" --action Main

Can anyone tell me how to do this? 

1 Answer

0 votes
by (19k points)

If you want to run Java process, you can pass properties like below: 

-Dproperty=value

//you have to set system property value.

//For a String value with spaces, you need to enclose it with double quotation: 

java -Dmydir="some string" SomeClass

For further reference, refer here 

Interested in Java? Check out this Java Certification by Intellipaat.

Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...