Skip to content

Setting Up Your Development Environment

chriscasola edited this page Mar 13, 2013 · 11 revisions

The easiest way to develop for WPISuite is to use Eclipse. You can run Eclipse on Windows, Linux, or Mac and easily import all of the projects in the repository. Eclipse also makes it relatively painless to run WPISuite on your local machine.

Table of Contents

Requirements

Install the Sun JDK 7

  • On Ubuntu, type sudo apt-get install openjdk-7-jdk
  • On OS X, follow these installation instructions for installing the JDK 7 from Oracle.
  • Windows
    • Go to the Download Page for the Sun JDK 7 and download the installer for Windows x86 (or 64 as long as both your Eclipse installation and Tomcat installation are 64-bit, this is not recommended)
    • Run the installer and accept all of the defaults but note the path where the jdk is installed
    • If you had Java installed previously do the following:
      • Open the start menu, right-click on Computer, and click Properties
      • Open Advanced System Settings from the pane on the left
      • Click the Environment Variables button at the bottom of the dialog window
      • Check both the list of user variables and the list of system variables for a variable called JAVA_HOME. If it does not exist click New under system variables and create it. For the variable value use the path where you installed the jdk.
      • In the system variables list there should be a variable called PATH. You need to edit this, do not clear the value. Simply append %JAVA_HOME%\bin; to the beginning of the value.
      • Your PATH should look something like this now: %JAVA_HOME%\bin; (with other paths after the semicolon)
      • Your JAVA_HOME variable should have something like: C:\Program Files (x86)\Java\jdk1.7.0_17;
      • At this point you should restart your computer. Then open a command prompt window and verify that running the command java -version indicates you are running the version of Java that was just installed.

Install Eclipse and Eclipse Plugins

  1. Install Eclipse using the link provided above. Choose the version for Java Developers.
  2. Once you run Eclipse, it will ask you to choose a workspace location, choose an empty folder on your computer and click OK.
  3. Open the Eclipse Help Menu and click Install New Software.
  4. In the Work With drop-down select the update site for your version of Eclipse.
  5. Under the Web, XML, Java EE and OSGi Enterprise Development section you will find all of the plugins listed above, except Egit. Simply check them off.
  6. Next, under the Collaboration section you will find Eclipse Egit, check that off as well.
  7. Click "Finish" to install the plugins.

Note: If Eclipse was already installed, but you want to tell it to use the JDK 7, do the following:

  1. In Eclipse, select Window > Preferences > Java > Installed JREs
  2. Click "Add", choose "Standard VM", and click "Next"
  3. Type in the JRE home of the JDK you just installed
    • Linux is usually at /usr/lib/jvm/some-directory-in-here
    • OSX is likely /Library/Java/JavaVirtualMachines/jdk/Contents/Home
    • Windows 7 is at C:\Program Files (x86)\Java\jdk
  4. Make sure the system libraries appear in the list box and click "Finish"

Install and Configure Tomcat 7

There are a couple of options for installing Tomcat 7. You can allow Eclipse to download the Tomcat jar and configure itself, or you can manually install Tomcat 7 and then point Eclipse to the install directory.

To take the easy route and let Eclipse get everything setup for you do the following:

  1. Open the Eclipse preferences window (under the Window menu, or the Eclipse menu on Mac systems)
  2. Expand the Server section and then Runtime Environments.
  3. Click the Add button and select Apache Tomcat v7.0.
  4. Check Create a new local server and then click Next.
  5. Click the Download & Install button to automatically download and install Tomcat. Then click Finish.

To manually install and configure Tomcat 7:

  • Installing Tomcat on Ubuntu
    1. Install Tomcat 7 (with sudo apt-get install tomcat7 or from this downloads page)
  • Installing Tomcat on OS X
    1. The easiest way is to use the homebrew package manager, if you don't have it you can get it by running this command ruby -e "$(curl -fsSkL raw.github.com/mxcl/homebrew/go)"
    2. Do brew doctor to verify brew is installed correctly
    3. Run brew update to update your local repository
    4. Run brew install tomcat to install Tomcat 7 ([see these instructions for more help] (http://railscoder.com/installing-tomcat-with-homebrew-on-osx/))
    5. The default install directory of Tomcat is /usr/local/Cellar/tomcat/7.xx.xx/libexec
  • Install Tomcat on Windows
    1. Download the 32-bit Windows Zip from http://tomcat.apache.org/download-70.cgi
    2. Unzip the file into a convenient location (perhaps C:\Tomcat7)
  • Configure Eclipse to use Tomcat on all operating systems Follow the instructions for the "easy route" above. Except instead of clicking "Download and Install", browse for the bin directory inside your Tomcat installation directory.

If you have issues installing and configuring Tomcat, see Fixing Tomcat Issues.

Install Git

In order to work with Git repositories on your local computer, you should install the latest version of Git from the link above. This guide will provide a brief overview on how to use Git, but the Git Book is an excellent resource for future reference.

In order to push from your local repositories to GitHub, you will need to generate and add an SSH key to your GitHub account if you have not already done so. See this page for instructions on how to do this. Alternatively, you can use the Git credential manager and HTTPS repository URLs, which will let you push to GitHub using your GitHub username and password. This might be easier for Windows users, but this guide assumes SSH.

Clone the Repository Onto Your Machine

  1. Assuming you have Forked the main repository into your own Github account, you should see a wpi-suite-tng repository in your GitHub account (or you might be using a fork that a teammate set up). Open the repository in GitHub and copy the SSH URL, which should look something like git@github.com:your_github_account/wpi-suite-tng.git
  2. Open a Terminal - on Windows you'll need to use "Git Bash" which you can find through the start menu
  3. Use the cd command to change to the directory you want to clone into (e.g. cd ~/Documents/WPI/SoftEng).
  1. Type the following command to clone the repository into a new wpi-suite-tng directory: git clone git@github.com:your_github_account/wpi-suite-tng.git
  2. If you type ls you should now see a folder called wpi-suite-tng, this is your local git repository
  3. Use cd wpi-suite-tng to move into the repository folder
  4. Type git checkout master to check out (for example) the master branch, which you should be on by default

Import Existing WPISuite Projects into your Eclipse Workspace

At this point you'll have all of the source code on your machine, but you'll have to import the Java projects in order to use them with Eclipse. These steps require EGit, which has some nice features for Git/Eclipse integration, but we have run into trouble with using it for day-to-day development and still recommend the command line. You can import the projects without EGit with these instructions.

  1. In Eclipse, open Window Menu --> Open Perspective --> Other.
  2. Select Git Repository Exploring and click OK.
  3. In the left pane, select the option to Add an existing local git repository to this view.
  4. Browse to your workspace directory, click OK, and you should see your git repo listed. Select it and click Finish.
  5. Right-click on the Working Directory folder under your repository hierarchy and click Import Projects.
  6. Select Import Existing and click Next.
  7. Select at least the following projects to import: Janeway, Network, WPISuite, WPISuite-Interfaces.
  • However, it's probably a good idea to just import all of the projects in the repository
  1. Click Finish.

You should now see the projects in your workspace.

Building WPISuite

Building WPI Suite

Run WPISuite locally

Running WPI Suite TNG Locally