edit upload recent print


* WikiDocs

Main » EclipseAndLibs

Using RiTa with Eclipse

  1. If you don't yet have it, download and unzip RiTa.zip from http://www.rednoise.org/rita to a location of your choice (these instructions are also applicable for RiTaTTS (with Text-To-Speech support) and RiTa.WordNet).
  2. Like we did w' the Processing classes (core.jar), we need to give Eclipse access to the RiTa classes (rita.jar, support.jar, etc.) by copying them into the project.
    • Navigate to the directory where you unzipped RiTa (e.g., $PROCESSING_SKETCH_PAD/libraries/rita), and open the 'library' directory. Select all the jars inside and copy/paste them into your Eclipse project (at the top level is fine.)
    • Now find the newly added jar files within your Eclipse project, right-click and select 'Build-Path'->'Add-to-Build-Path'.
    • Note: you can also link to these jars in their existing locations, and/or create a 'user-library' for them, but the above (at least when just starting out) is simplest.
  3. Now tell Java that you want it to 'import' the RiTa classes when it compiles your code by adding this line at the top of the Java file:

        import rita.*;
  4. Add a RiTa object to your project, for example:
           public void setup()
             size(300, 300);
             new RiText(this, "TEST");
And that's it - now run your applet (Menu: Run -> Run-As -> Java-Applet) to test.

Processing with OpenGL in Eclipse

  • Prepare a Processing project in eclipse following the steps above.
  • To use OpenGL, we 1st need to tell Eclipse about the OpenGL classes (same as Processing & RiTa). In the Processing application folder, find the following jar files and copy them into your sketch (you can also link to them via the Eclipse menus):
Note: The location of these files will vary depending on where you installed Processing, but on Windows it might be C:\Program Files\Processing1.x\libraries\opengl\library\. On a Mac, Processing will usually be in /Applications/Processing1.x, but to view the contents of this directory you must first right-click and choose 'Show Package Contents', then navigate down to Contents/Resources/Java/libraries/opengl/library/). Whew...
  • Now select the 3 jar files from within your Eclipse project, right-click and select 'Build-Path'->'Add-to-Build-Path'. Note: you can also link to these jars in their existing locations, and/or create a 'user-library' for them, but the above is (at least when just starting out) simplest.
  • For OpenGL (unlike Processing or RiTa), we also need to link to the required native libraries (which are platform specific.) Return to the same directory where oyu found the openGL jars and select the appropriate files for your platform (for windows, all files ending in .dll, for linux, those ending in .so, and for mac, those ending in .jnilib, as below):
       for mac:

  • If you are going to run your sketch as an applet, copy the files into the src folder of your java application. If you are going to run the sketch as an application, copy the files into the base folder of your java application. If you are not sure (or want to be able to do both), copy the files to both locations.
Note: You can also use the '-Djava.library.path=/path/to/natives' option to explicitly specify the libraries to load.
  • Now everything should be linked correctly, so open up a new class, or your main class (this was located in src->mypackage->HelloProcessing in the HelloWorld example) and paste the test code below (notice the addition of the OPENGL constant in the call to size()).

            package mypackage; // your package name

            import processing.core.PApplet;

            public class HelloProcessing extends PApplet  // your class name
              float x=0, y=0, z=0;

              public void setup()
                size(300, 300, OPENGL);

              public void draw()
                if (x > width){

  • Now run your applet! (Menu: Run->Run-As->Java-Applet)

Instructor: Daniel C. Howe



Page last modified on October 01, 2009, at 02:20 PM EST