Skip to content
James Conroy edited this page Mar 13, 2019 · 16 revisions

Command line support is now available for Java mode.

  • On Windows and Linux, use the processing-java program that's in the download.
  • On Mac OS X, there's an option in the Tools menu to install the command line tool.

processing-java's options are

--help Show this help text. Congratulations.

--sketch= Specify the sketch folder (required)

--output= Specify the output folder (optional and cannot be the same as the sketch folder.)

--force The sketch will not build if the output folder already exists, because the contents will be replaced. This option erases the folder first. Use with extreme caution!

--build Preprocess and compile a sketch into .class files.

--run Preprocess, compile, and run a sketch.

--present Preprocess, compile, and run a sketch in presentation mode.

--export Export an application.

--no-java Do not embed Java. Use at your own risk!

--platform Specify the platform (export to application only). Should be one of 'windows', 'macosx', or 'linux'.

The --build, --run, --present, or --export must be the final parameter passed to Processing. Arguments passed following one of those four will be passed through to the sketch itself, and therefore available to the sketch via the 'args' field. To pass options understood by PApplet.main(), write a custom main() method so that the preprocessor does not add one. https://github.com/processing/processing/wiki/Command-Line

Example and Explanation

processing-java --sketch=/full/path/to/your/sketch/dir --output=/path/to/output/dir --force --run

This is an example of processing-java running a sketch.

--sketch is required. It provides the file path to the sketch you want to run.

--output is optional. It defines the output file for the sketch

--force is optional. It will build the sketch even if there is an output directory that would be overwritten.

--run is the action that processing-java will perform on the sketch. Either build, run, export, or present needs to be present when processing-java is called, and they must be the last argument given to processing-java.

Common issues

sketchname does not exist

Cause: the full path to the sketch was not specified using --sketch Cause: the dir containing the sketch is different from the sketch name

Notes

  • On Mac OS X, you may need to reinstall the command line tool after downloading a new version of Processing.

  • Build and export options should even work in headless mode when enabled. No guarantees, but simple test results were promising. If you run into trouble, please let us know by posting a bug report. Note that even though the compiler can run in headless mode, Processing sketches still cannot.

  • You cann