2

我正在尝试从另一个 java 程序中调用我的模拟模型。我按照官方说明获得了如下代码:

package test;

public class UserMain {

public UserMain(){};

  public void start(){

    String[] args = new String[]{"D:\\user\\model\\Repast_java\\IntraCity_Simulator\\IntraCity_Simulator.rs"};

//    repast.simphony.runtime.RepastMain.main(args);
  }

  public static void main(String[] args) {

    UserMain um = new UserMain();
    um.start();
  }
}

它没有用。我认为这是由于错误的类路径。如何正确配置?

Note that you need to have repast.simphony.runtime/bin and the jars in repast.simphony.runtime/lib on your classpath since the runtime needs these to start.
4

1 回答 1

2

这更像是关于如何使用 Java 的类路径的 Java 或 Eclipse 问题。但简而言之,如果您从命令行运行,您可以使用 -cp 参数来指定类路径。一个快速的谷歌应该提供详细信息。在 Eclipse 中,类路径在应用程序的运行配置(运行 -> 运行配置)的依赖项选项卡中指定。

于 2019-12-03T18:25:46.287 回答