Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run Processing applications from the terminal

I'm currently using Processing for a small project, however I'm not liking the text-editor that comes with it. I use vim to write all of my code. I've found where the .pde file are and I've been editing them from vim and then I'm reopening them and running them (it takes a lot to reload the script and running it). That's why I want a solution where I can compile everything from the terminal.

On close inspection I've found the processing-java file that supposedly compiles and runs a sketch. However whatever arguments I supply it, it keeps on spitting the help page. This is an example on how I'm running them.

(PS: I made a script that runs processing-java and added it to /usr/bin)

processing-java --sketch=/home/george/sketchbook/testproject --output=/tmp/processing/test --force --run

Can anyone help me please run my sketchs from the terminal?

like image 709
george Avatar asked Feb 09 '13 10:02

george


3 Answers

I managed to do it by creating a bash script called pjava and the code is as follow if anyone is having this question:

#!/bin/bash
rm -rf /tmp/processing
mkdir /tmp/processing
/home/euler/Desktop/processing-2.0b8/processing-java --output=/tmp/processing/ --force --sketch=$1 --run

And the way I run it is as follow:

If I am inside a folder called project, I run pjava ../project and project.pde will get compiled and run.

like image 171
george Avatar answered Oct 11 '22 06:10

george


I know that this is late, but a simpler way would be to do it like this (assuming processing-java is in your path).
processing-java --sketch=$PWD --run
and add it to an alias:
alias pjava='processing-java --sketch=$PWD --run

like image 32
Asher Avatar answered Oct 11 '22 07:10

Asher


You can also just keep the processing app open and use any editor.

When you save the changes in say VS code (I have the processing extension but don't think that does anything but syntax highlighting), it will show in the processing app and you can run it from there. Having a script is nice, but processing's visual interface is handy too.

like image 1
yankeedoodle Avatar answered Oct 11 '22 08:10

yankeedoodle