-
Notifications
You must be signed in to change notification settings - Fork 39
Setting Up Your Development Environment
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.
- Requirements
- Install the Sun JDK 7
- Install Eclipse and Eclipse Plugins
- Install and Configure Tomcat 7
- Install Git
- Clone the Repository into your Eclipse Workspace
- Import Existing WPISuite Projects into your Eclipse Workspace
- Building WPISuite
- Run WPISuite locally
- Sun JDK 7
-
Eclipse IDE for Java Developers with the following plugins:
- Eclipse Java EE Developer Tools
- Eclipse Java Web Developer Tools
- JST Server Adapters
- JST Server Adapters Extensions
- EGit
- Tomcat 7
- Git
- 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 using the link provided above. Choose the version for Java Developers.
- Once you run Eclipse, it will ask you to choose a workspace location, choose an empty folder on your computer and click OK.
- Open the Eclipse Help Menu and click Install New Software.
- In the Work With drop-down select the update site for your version of Eclipse.
- 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.
- Next, under the Collaboration section you will find Eclipse Egit, check that off as well.
- 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:
- In Eclipse, select Window > Preferences > Java > Installed JREs
- Click "Add", choose "Standard VM", and click "Next"
- 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
- Make sure the system libraries appear in the list box and click "Finish"
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:
- Open the Eclipse preferences window (under the Window menu, or the Eclipse menu on Mac systems)
- Expand the Server section and then Runtime Environments.
- Click the Add button and select Apache Tomcat v7.0.
- Check Create a new local server and then click Next.
- 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
- Install Tomcat 7 (with
sudo apt-get install tomcat7
or from this downloads page)
- Install Tomcat 7 (with
- Installing Tomcat on OS X
- 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)"
- Do
brew doctor
to verify brew is installed correctly - Run
brew update
to update your local repository - Run
brew install tomcat
to install Tomcat 7 ([see these instructions for more help] (http://railscoder.com/installing-tomcat-with-homebrew-on-osx/)) - The default install directory of Tomcat is /usr/local/Cellar/tomcat/7.xx.xx/libexec
- The easiest way is to use the homebrew package manager, if you don't have it you can get it by running this command
- Install Tomcat on Windows
- Download the 32-bit Windows Zip from http://tomcat.apache.org/download-70.cgi
- 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.
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.
- 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
- Open a Terminal - on Windows you'll need to use "Git Bash" which you can find through the start menu
- Use the
cd
command to change to the directory you want to clone into (e.g.cd ~/Documents/WPI/SoftEng
).
- 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
- If you type
ls
you should now see a folder called wpi-suite-tng, this is your local git repository - Use
cd wpi-suite-tng
to move into the repository folder - Type
git checkout master
to check out (for example) the master branch, which you should be on by default
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.
- In Eclipse, open Window Menu --> Open Perspective --> Other.
- Select Git Repository Exploring and click OK.
- In the left pane, select the option to Add an existing local git repository to this view.
- Browse to your workspace directory, click OK, and you should see your git repo listed. Select it and click Finish.
- Right-click on the Working Directory folder under your repository hierarchy and click Import Projects.
- Select Import Existing and click Next.
- 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
- Click Finish.
You should now see the projects in your workspace.