Skip to main content

1. Download the FinchJavaCommandLine package and unzip it to a convenient directory.

2. Navigate to the src directory.

LINUX USERS ONLY: 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. Compile a file by using the following incantation, where FILEPATH is the location of your file relative to the SourceFiles:

Windows: javac -classpath “.;../libs/*” com\birdbraintechnologies\Finch.java FILEPATH

Mac/Linux: javac -classpath “.:../libs/*” com/birdbraintechnologies/HummingbirdRobot.java FILEPATH

For example, if you wished to compile Dance.java, which is located in Code/simpleOutput/Dance.java, you would use:

Windows: javac -classpath “.;../libs/*” com\birdbraintechnologies\Finch.java Code\simpleOutput\Dance.java

Mac/Linux: javac -classpath “.:../libs/*” com/birdbraintechnologies/Finch.java Code/simpleOutput/Dance.java

4. Run a file with the following incantation, where FILEPATH is the location of the compiled .class file you wish to run:

Windows: java -cp “.;..\libs\*;com\birdbraintechnologies\Finch” FILEPATH

Mac/Linux: java -cp “.:../libs/*” FILEPATH

Linux users may need to use sudo. If you don’t want to use sudo, follow these instructions to make it so regular users can access the Finch (credit: Meg Richards) or run this script (credit: Justin Lee).

For example, if you wanted to run the previously compiled Dance.java, you would use:

Windows: javac -classpath “.;../libs/*” com\birdbraintechnologies\Finch.java Code\simpleOutput\Dance.java

Mac/Linux: java -cp “.:../libs/*” Code/simpleOutput/Dance

Note that you do not need to append “.class” to the end of your filename when using the java command.

It is safe to ignore warnings that occur before the “Connecting to Finch…” message.

Back to Top