| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Warning
This page has not been updated in a long time and may contain outdated information. For command line usage in Processing 4 or later versions, see this wiki page.
Running sketches in the Processing IDE is cool, but running them in the command-line is even cooler! Running in the command-line means you can automate your sketches, run them without opening the IDE, run sketches on embedded devices, or have sketches run on boot... all super useful!
| COMMAND | INFO |
|---|---|
| --help | Show this help text :) |
| --sketch=<path> | Specify the sketch folder (required) |
| --output=<path> | 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! |
| --variant | Specify the variant (export to application only), should be one of: macos-x86_64, macos-aarch64, windows-amd64, linux-amd64, linux-arm or linux-aarch64 |
A few things to note:
Some examples for using processing-java...
If you want to include arguments passed from the command line into your sketch, you can add them after the --run, --present, etc commands. For example, here we pass the width and height to a sketch:
processing-java --sketch=/full/path/to/your/sketch/folder --present 600 600
In your sketch, you can access the arguments like this:
void settings() {
// if there are arguments, change the sketch's size
if (args != null) {
int w = Integer.parseInt(args[0]);
int h = Integer.parseInt(args[1]);
size(w, h);
}
// might want to have an option if arguments are
// not present or incomplete – here we just set the
// size manually :)
else {
size(400, 400);
}
}
A few common things that might go wrong:
Error Sketchname does not exist
This can be because the full path to the sketch was not specified using the --sketch argument or that the folder containing the sketch is different from the sketch's name.
processing-java previously installed but no longer working
On Mac OSX, you may need to reinstall the command line tool after downloading a new version of Processing :(
Running your sketch "headless" (ie without a display) may require some extra work, see Running Without a Display for more info.
The --build and --export options should even work in headless mode when enabled. If you run into trouble building or exporting from the command-line, please let us know by posting a bug report.
| Back | FazBrowse Home | New Git URL |