Command Line Java Compilation

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

2.  Navigate to the SourceFiles 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 ;finch.jar FILEPATH

Mac/Linux:  javac -classpath :finch.jar FILEPATH

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

Windows: javac -classpath ;finch.jar Code/looping/Spiral.java

Mac/Linux: javac -classpath :finch.jar Code/looping/Spiral.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 finch.jar; FILEPATH
 
Mac:  java -cp finch.jar:jnaerator-0.9.5.jar: FILEPATH

Linux: sudo java -Djava.library.path=. -classpath finch.jar:jnaerator-0.9.5.jar: FILEPATH

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 Spiral.java, you would use:

Windows:  java -cp finch.jar; Code/looping/Spiral

Mac:  java -cp finch.jar:jnaerator-0.9.5.jar: Code/looping/Spiral

Linux: sudo java -Djava.library.path=. -classpath finch.jar:jnaerator-0.9.5.jar: Code/looping/Spiral

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

Mac and Linux users, note that you need to add both finch.jar and jnaerator-0.9.5.jar to the classpath.

Linux users - it is safe to ignore warnings that occur before the "Connecting to Finch..." message.