IntelliJ中Java类的命令行选项
我使用IntelliJ运行一些数据分析类,但我对Java本身不太熟悉。 与我以前运行过的Java类不同,这个类显然需要一些配置选项 以下是代码的前几行:IntelliJ中Java类的命令行选项,java,intellij-idea,Java,Intellij Idea,我使用IntelliJ运行一些数据分析类,但我对Java本身不太熟悉。 与我以前运行过的Java类不同,这个类显然需要一些配置选项 以下是代码的前几行: public class CountWorkplaces { static public void main(String[] args) throws IOException { CommandLineConfigurator cmd = new CommandLineConfigurator(args); String in
public class CountWorkplaces {
static public void main(String[] args) throws IOException {
CommandLineConfigurator cmd = new CommandLineConfigurator(args);
String inputPath = cmd.getArguments().get(0);
String outputPath = cmd.getArguments().get(1);
if (!(cmd.hasOption("population") ^ cmd.hasOption("facilities"))) {
throw new IllegalArgumentException();
}
为了运行这个类,我在程序参数行中指定了一个inputPath,后跟一个outputPath。我猜cmd.haspoption希望我指定一个填充文件或一个设施文件
如何传递此选项?有专门的语法吗?您需要提供以下选项之一作为程序参数: -设施或人口 例如:
java Class --facilities inputPath outputPath
或
java类-填充inputPath outputPath出于好奇,CommandLineConfigurator这是库类还是用户定义类?它似乎是一个用户定义类,包含在我提供的包中。