GroIMP will can receive and use arguments in the command line. Such arguments can be either used by groimp, or forwarded to the project, and accessible there.
java -jar core.jar –project-tree
The command above can be split in two:
The additional java arguments are inserted AFTER the -jar core.jar argument.
In the given example, the GroIMP argument is –project-tree.
A non exhaustive list of common Java arguments used with GroIMP:
–project-tree this argument is used when GroIMP is run in Eclipse, it tells GroIMP to load classes under the local /PLUGIN/target/classes/ repositories where PLUGIN is the name of each directories at the root of GroIMP. This path is different when GroIMP is run after packaging. By default GroIMP load classes in ./plugins/PLUGIN/PLUGIN.jar where PLUGIN is the name of each plugins.–headless this argument start GroIMP headless, i.e. without a graphical interface. Usually you also define the project to open as an argument.-a api this argument defines which application will be started (current available application: imp, cli, api). By default GroIMP starts with imp.-p /path/to/a/directory/ link a directory to the list of loaded plugins. path/to/a/model.gsz this argument requires to be used last. It gives a model to be opened after start.
It is possible to forward parameters from the command line to the GroIMP simulation using additional parameters beginning with an capital X.
so for a variable called number with the value 5 the additional parameter would be -Xnumber=5. This value can than in the simulation be recalled by Main.getProperty(“number”)
A tutorial for this can be found here
Note: if you run GroIMP from Eclipse, the GroIMP arguments can be set in the Run Configuration…>x() = Arguments>Program arguments
-a {application} this argument defines which application will be started (current available application: GUI, cli, api). By default GroIMP starts with GUI.
e.g. -a api.
-- -cmd "/path/to/command" run a specific GroIMP command when starting GroIMP
--headless this argument start GroIMP headless, i.e. without a graphical interface. Usually you also define the project to open as an argument.
' ' {path/to/a/model.gsz} this argument requires to be used last. It gives a model to be opened after start. The ' ' represent a white space.
-p {/path/to/a/directory/} link a directory to the list of loaded plugins.
Parameter value & PM file
--project-tree this argument is used when GroIMP is run in Eclipse, it tells GroIMP to load classes under the local /PLUGIN/target/classes/ repositories where PLUGIN is the name of each directories at the root of GroIMP. This path is different when GroIMP is run after packaging. By default GroIMP load classes in ./plugins/PLUGIN/PLUGIN.jar where PLUGIN is the name of each plugins.
-t {/path/to/config/file}. It makes GroIMP use the config file as main option.
-Xvar=value