Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Java by (9.5k 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 (19.7k 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.

Related questions

Browse Categories

...