I'd like to use the args4j Java library in my Scala v2.10 application. However, I am running into some trouble. As an example, I have a class to store my arguments in Java as follows.
public class MyArgs {
@Option(name = "-i", usage = "file input", required = true)
private String input;
public String getInput() { return input; }
}
I then have a Scala program like the following.
object TestArgs {
def main(args: Array[String]): Unit = {
val myArgs = new MyArgs()
val cmdLineParser = new CmdLineParser()
try {
cmdLineParser.parseArgument(java.util.Arrays.asList(args: _*))
} catch {
case e: Exception => {
System.err.println(e.getMessage)
}
}
}
}
In IntelliJ, I pass in something like -i some/path/to/file.txt
, but i keep getting the following message.
"-i" is not a valid option
Any ideas on what's going on?