i packaged classes , libraries single jar file. current code cannot access files inside jar file is.
string scenariofile = "netlogo/altruism.nlogo"; // inputstream = this.getclass().getresourceasstream(scenariofile); simulator = headlessworkspace.newinstance(); simulator.open(scenariofile);
the .open expects string read need use inputstream format not working. there other workaround?
with of tunaki able way doing , worked!
what did download commons.io.jar file
import org.apache.commons.io.*;
and use inputstream read file , convert string , use openfromsource method tunaki suggested of headlessworkspace package read it.
inputstream = this.getclass().getresourceasstream(netlogofile); string scenariofile = ioutils.tostring(is, "utf-8"); simulator = headlessworkspace.newinstance(); simulator.openfromsource(scenariofile);
Comments
Post a Comment