You are here

Running from command line

jACT-R did support command line execution back in the day. It was meant to make it easier to execute in "lighter" environments (i.e., within a game engine, controlling a robot, on a cell phone, whatever). As time progressed, it became clear that a general solution for that was at odds with the primary use case: modelers trying to build and analyze their particular phenomenon.

The primary use case relies heavily upon OSGi and Eclipse's dynamic and modular tools. These, however, make traditional command lines much more difficult (and unwieldy). OSGi and Eclipse dynamically check project dependencies and securely set up the various classloaders and resource paths, as well as extensions (for parser, compilers, modules, extensions, etc.) and the actual runtime environment.

This does not mean that you can't run from the command line. You can, but it is a really bad idea to use that mode for the development of a model. Only after you have built, tested, and hardened your model in the IDE should you even think about embedding or command line execution.

Let's assume your model is the awesomsauce and you want to run it command line now. First, you will need the environment.xml file that the IDE generated in the run directory. This tells the org.jactr.entry.Main entry point how to assemble the environment. You will want to strip out the attachments : and, as they are only for IDE runs.

Next, you need the command line that Eclipse uses. To do this, run your model, switch to the debug view and bring up the properties of the running processes. It will include the actual command line. It looks something like this:

/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/java -Dorg.apache.commons.logging.log=org.apache.commons.logging.impl.Log4JLogger -Dlog4j.configuration=file:/Users/harrison/Archive/Development/workspaces/modeling-dev/ -Dfile.encoding=MacRoman -Xbootclasspath/p:/Users/harrison/Archive/Development/Apps/3.7/eclipse-model-dev-32/plugins/org.eclipse.jdt.debug_3.7.100.v20120529-1702/jdi.jar -classpath /Users/harrison/Archive/Development/Apps/3.7/eclipse-model-dev-32/plugins/org.eclipse.equinox.launcher_1.3.0.v20120522-1813.jar org.eclipse.equinox.launcher.Main -application org.jactr.launching.application -data /Users/harrison/.jactr/workspaces/ -configuration file:/Users/harrison/.jactr/configuration/ -dev file:/Users/harrison/.jactr/configuration/ -name jACTR -nosplash -os macosx -arch x86 -e file:/Users/harrison/Archive/Development/workspaces/modeling-dev/

There's a lot of mess in there. Let's break it down.

  • -Dorg.apache.commons.logging.log=org.apache.commons.logging.impl.Log4JLogger merely tells the runtime what logger to use. This is optional and controled view the Logging/Trace tab of the run configuration window.
  • -Dlog4j.configuration=file:/Users/harrison/Archive/Development/workspaces/modeling-dev/ this is the logging config file used, again optional.
  • -Dfile.encoding=MacRoman -Xbootclasspath/p:/Users/harrison/Archive/Development/Apps/3.7/eclipse-model-dev-32/plugins/org.eclipse.jdt.debug_3.7.100.v20120529-1702/jdi.jar -classpath /Users/harrison/Archive/Development/Apps/3.7/eclipse-model-dev-32/plugins/org.eclipse.equinox.launcher_1.3.0.v20120522-1813.jar org.eclipse.equinox.launcher.Main -application org.jactr.launching.application This is the main entry point for the jactr-in-eclipse application. Jar files will be dependent upon the version of eclipse you have installed, and where you have it installed.
  • -data /Users/harrison/.jactr/workspaces/ -configuration file:/Users/harrison/.jactr/configuration/ -dev file:/Users/harrison/.jactr/configuration/ Anything in the ${home}/.jactr/ directory tree is where eclipse stores cached data to accelerated subsequent launches. The contents of these directories is generated on runtime, unless the data already exists. The file tells the environment how to combine your workspace projects (i.e., your model) and installed bundles.
  • -name jACTR -nosplash -os macosx -arch x86 These are platform specific flags to tell the runtime what to expect (line endings, path separators, etc).
  • -e file:/Users/harrison/Archive/Development/workspaces/modeling-dev/ this tells the jACT-R environment to build the environment and wait for the IDE to signal the start. Using -r, instead, will build the environment and immediately execute it.

That will get you up and running on the command line, but again, I don't recommend it. The IDE provides you a ton of tools that will help you understand your model. Command line ninjas will always be at a disadvantage here.