Setting Up Your Environment
In order to work with LensKit and complete the assignments, you need a few things:
- A Java Development Kit
- A Java development environment; we recommend IntelliJ IDEA, and the free Community Edition is sufficient to do most things with LensKit.
- For the later assignments: some means of analyzing data (in CSV format) and producing charts. Excel or LibreOffice Calc will suffice; R and Python are options as well. We provide examples in R.
On Windows, the installers for Java and IntelliJ are mostly adequate. The full procedure is the following:
Install the JDK using the latest installer from http://java.oracle.com. You need to download a JDK installer for J2SE; a JRE installer is not sufficient.
Create an environment variable so other programs can find Java. To do this, go to the Start menu and search for ‘environment’; one of the options is ‘Set up environment variables for your account’. Choose this, then Add a new environment variable. The variable's name will be
JAVA_HOME, and its value will be the path to your JDK installation. This is typically something like
C:\Program Files\Java\jdk1.8.0_60. You will need to update the value of this variable every time you update your Java installation.
HOMEenvironment variable. This should point to your user's base directory, e.g.
C:\Users\michael. You can just set this to the value
%USERPROFILE%and it will automatically pick it up from the Windows equivalent to
HOME. Having an explicit
HOMEvariable makes some software happier.
Install IntelliJ IDEA using its Windows installer.
Then you should be ready to go!
Mac OS X Setup
Mac setup is pretty much the same, with the added wrinkle of installing a separate Java for IntelliJ to use.
Install the JDK using the latest installer from http://java.oracle.com. You need to download a JDK installer for J2SE; a JRE installer is not sufficient. This is the Java that you will use to run LensKit.
Download IntelliJ IDEA and drag the application to your Applications folder.
Set up your Java environment in IntelliJ:
- Launch IntelliJ
- In the startup screen, pick 'Configure' -> 'Project Defaults' -> 'Project Structure'
- Select 'SDKs'
- Click '+', then 'JDK'
- Browse to your Java 8 (under
/Library/Java/JavaVirtualMachines), and choose the
Contents/Homedirectory under the JDK version you will be using.
We recommend installing the Java Development Kit from your distribution repositories. Install version 8 if it is available; otherwise, version 7 is enough to run LensKit.
Install the packages.
sudo apt-get install openjdk-8-jdk
openjdk-7-jdkif you don't have version 8 available.
sudo yum install java-1.8.0-openjdk-devel
Download and run the IntelliJ IDEA installer.
Testing the Environment
To make sure that your environment is ready to use, try to load the LensKit Hello project.
- Download the ZIP archive from https://github.com/lenskit/lenskit-hello.
- Unpack it somewhere on your hard drive.
- In IntelliJ, select 'Import project' or 'Open project'.
- Browse to your
lenskit-hellodirectory and select the
- Accept the default settings. If it does not indicate an available JDK, then you will need to add one; click the add button and browse to your JDK installation directory.
- If everything is working, the project should import successfully.
Congrats! You now have your LensKit development environment set up.