سؤال

I am trying to work with args4j. I created a dummy project that contains one single command line option called 'enableAuth'. See Features.java.

I tried to run this in eclipse with run configuration > program arguments as --enableAuth=true, -enableAuth=true, -enableAuth true etc., But none of them work for me. I run into CmdLineException always.

Any help is appreciated. Github project: https://github.com/seshumadhav/java-projects/tree/master/args4j-demo

هل كانت مفيدة؟

المحلول

For boolean fields I don't think we are suppose to give values(i.e. true/false). Just pass the argument as a flag

java XXX.java -enableAuth

If the field was non-boolean than it would have expected a value.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top