Processing Notes

  • This note assumes:
    1. You have installed Java 1.4 or greater.
    2. You have created a $JAVA_HOME environment variable.
    3. You have added the java /bin directory to your PATH.
    4. You have installed maven 2.
    5. You have created a $M2_REPO environment variable.
    6. You have added the maven /bin directory to your PATH.
  • If you can run mvn --version you are in good shape.

Create an empty Maven project

mvn archetype:create -DarchetypeArtifactId=maven-archetype-quickstart -DgroupId=org.processing.sketch -DartifactId=ExampleSketch

Example pom.xml for a Processing project

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>org.processing.sketch</groupId>
  <artifactId>ExampleSketch</artifactId>
  <packaging>jar</packaging>
  <version>1.0-SNAPSHOT</version>
  <name>ExampleSketch</name>
  <dependencies>

    <dependency>
      <groupId>org.processing</groupId>
      <artifactId>core</artifactId>
      <version>1.0.3</version>
    </dependency>

    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>

  </dependencies>
  
  <build>
    <plugins>
    
      <plugin>
        <artifactId>maven-assembly-plugin</artifactId>

        <configuration>
          <descriptorId>jar-with-dependencies</descriptorId>
          <archive>
            <manifest>
              <!-- NOTE: If you change the name of your class, change it here too. -->
              <mainClass>ExampleSketch</mainClass>
            </manifest>
          </archive>
        </configuration>
        
        <executions>
          <execution>
            <id>make-assembly</id>
            <phase>package</phase>
            <goals>
              <goal>single</goal>
            </goals>
          </execution>
        </executions>
          
      </plugin>
      
    </plugins>
  </build>


</project>
  • This pom is dependent on version 1.0.3 of the Processing core.jar which (in this case) should be in your maven repo at: $M2_REPO\org\processing\core\1.0.3\core-1.0.3.jar
  • Processing does not publish jars to maven repositories. It is a manual task to create this directory in your repo, move and rename the core.jar archive into this directory.

Import into Eclipse

  1. From the project root run:
mvn eclipse:eclipse
  1. In Eclipse select File > Import, choose Existing Projects into Workspace and click Next.
  2. Browse to the project root directory and click OK.
  3. The Projects box should have your project listed. (If not confirm that there is .classpath and .project file in your project root and that there isn't a project with the same name already in your workspace.)
  4. Click Finish.

Packaging code into Executable jar

mvn install
java -jar ExampleSketch-1.0-SNAPSHOT-jar-with-dependencies.jar

Processing Windows without Java - expert

cd C:\dev\tools\processing-1.0.3-expert-Wrj4P5
C:\dev\tools\java\jdk1.6.0_07\bin\java.exe ^
-classpath ^
lib;^
C:\dev\tools\java\jdk1.6.0_07\lib\tools.jar;^
lib\pde.jar;^
lib\core.jar;^
lib\jna.jar;^
lib\ecj.jar;^
lib\antlr.jar ^
processing.app.Base

Browse Space

- Pages
- Blog
- Labels
- Attachments
- Bookmarks
- Mail
- Advanced

Explore Confluence

- Popular Labels
- Notation Guide

Your Account

Log In

 

Other Features

Add Content