Eclipse - Jython/Python

Creating a Finch Jython Eclipse Project

1.  Make sure you have Jython installed. Download the latest version here.

2.  Make sure you have Python installed.

LINUX USERS:

  • You must open Eclipse using sudo to run Finch, or follow these instructions to make it so regular users can access the Finch (credit: Meg Richards).
  • You will need to install libusb-1.0 before compiling a program. To do so, run sudo apt-get install libusb-1.0-0-dev in any terminal window.

3.  Open Eclipse and install PyDev, the Python plugin for Eclipse.  Note that you must have Python installed before PyDev will run.  Good instructions for installing and configuring PyDev are available here.  Make sure to configure a Jython interpreter.

3.  Download the Generic Jython Finch software package and unzip it to a convenient directory.

4.  In Eclipse, go to File->New->Project.  In the resulting dialog, expand PyDev and select PyDev Project.  Hit Next.

5.  In the PyDev project window, name the project, uncheck "Use Default" and instead browse to the SourceFiles directory of the Finch software package.  Choose Jython as the Project Type and make sure the interpreter is pointed to the Jython interpreter.

6.  Hit Finish - the project should now be visible in the left hand pane.

7.  Right-click on the project name in the left hand pane and go to Properties.

8.  In the Properties menu, select PyDev - PYTHONPATH and add the Finch jar by selecting Add zip/jar/egg.  

Mac/Linux Users: You also need to add jnaerator-0.9.5.jar to the PYTHONPATH.

In Windows, when complete, the window should look like this:

9.  Hit OK.  The project should now be properly set up.

Mac/Linux users: You will need to copy the libhidapi32/64 files from the SourceFiles directory into the "Code" directory. Do so before you try running an example file. These files will need to be located in the same directory as any program you attempt to run.

Running an Example File (Windows and Mac)

1.  Expand Code in the package explorer on the left hand pane.

2.  Double click on a file to open it in the editor.

3.  Run the file by either clicking on the green run button, by going to Run->Run, or by hitting Ctrl-F11.  The first time you run an example Eclipse may ask you how to run the file - select "Jython Run".

Running an Example File (Linux)

1.  Expand Code in the package explorer on the left hand pane.

2.  Double click on a file to open it in the editor.

3.  Go to Run->Run Configurations.

4. In the right-hand pane, click on Arguments. 

5. Under VM arguments, add:

-Djava.library.path=.

6. Hit Run to run your file.

Creating a File

1.  Right click on Code, and select New->File.  Name the file with the .py extension.