-
Notifications
You must be signed in to change notification settings - Fork 0
GettingStarted
#summary Getting started with Java, NetBeans, and SVN FRC Team 610 programs our robot in Java. This page serves as a guide to getting started with Java development - installing the IDE, installing the FRC plugins, and connecting to the versioning software we use. = !NetBeans = !NetBeans is the preferred Java IDE for use by FRC teams using Java because the plugins for the WPIlib FRC library are developed exclusively for !NetBeans.
==JDK and JRE== To run Java on your computer, you will need the Java Runtime Envrionment (JRE). For !NetBeans to compile code properly on your computer, you need the Development Kit (JDK). Both are available [http://www.oracle.com/technetwork/java/javase/downloads/index.html here]. You will need the standard Java JRE and JDK, not the JavaFX or JavaEE bundles. Installation instructions are included on the site.
==Installing !NetBeans== Visit the [http://netbeans.org/downloads/ NetBeans Download Page] and choose your operating system from the menu in the top right corner of the page. For full support with FRC components, choose the third option (Java). The filesize is approximately 214 MB. An executable file will be downloaded to your computer, to install !NetBeans run the executable and accept the default options.
==Installing FRC Plugins== The FRC Java plugins are provided by an official third party, Worcester Polytechnic Institute (WPI). The updated plugins can be found in [http://firstforge.wpi.edu/sf/frs/do/downloadFile/projects.wpilib/frs.wpilib_java_update_for_2011_frc.wpilib_java_frc_2011_update_ve_1/frs1219?dl=1 this] unencrypted .zip file. Unzip the file to a folder. To install them, open !NetBeans, then from the Tools menu choose Plugins. In the dialog box that pops up, switch to the Downloaded tab and click Add Plugins and navigate to where you unzipped the files. Click the first file (edu-wpi-first-squawksdk.nbm), not folder, then hold down the SHIFT key and click the last file to select all five. To finish, click Open and then Install. Before they install, windows will appear warning that the plugins are not signed. Accept the warnings and continue installation. At the end of the installation you will have to restart !NetBeans. =Version Control= With version control, we can keep track of old versions of code, as well as allow multiple users to work simultaneously. We use SVN (SubVersioN) to do this, hosted at Google Code. When you upload a new file (even this page), the old versions are stored, so they can be referred to at any time.
==Installing a Client== The following instructions were written for Windows. Similar programs are available in the form of RabbitVCS for Linux and SCPlugin for Mac OSX, but the installation and specific use will differ. There are many SVN clients available, and you can use any you choose. [http://tortoisesvn.net/downloads.html TortoiseSVN] is a very simple and easy extension for Windows. You can download it at the link provided. After following installation instructions, you will not find any program on your start menu or task bar. Instead, it is a shell extension, meaning that in an Explorer Window, if you right click, you will get TortoiseSVN options.
==Using TortoiseSVN== First, a primer on SVN. The idea is that you store all your code on a server, called a repository. Users 'check out' code, like checking a book out of a library. When they're done editing the code, they can 'commit' the code to the repository, saving it as a new 'revision' of the code. Old revisions are saved to the repository, so if something has been overwritten in the code, it can still be seen. Be very careful! Subversion is designed never to lose anything, so if you upload something to the repository, it is extremely difficult to remove! Don't upload anything you don't want to be seen! This section will explain how to check out, update, and commit code. If you use a different client from TortoiseSVN, from here on out you are on your own, though you will find similarities.
===Checking out Code=== With Tortoise, checking out code only needs to be done once. Afterwards it can just be updated. The main files we will be sharing are !NetBeans projects. However, !NetBeans and Tortoise both like beginning with an empty folder. The solution is to download the existing project with Tortoise and open it with !NetBeans. This example will involve downloading the XII project, whose contents can be browsed [http://code.google.com/p/robotics610/source/browse/#svn%2Ftrunk%2FXII here]. Within the !NetBeansProjects folder that is created the first time you create a project with !NetBeans, create an empty folder called 'XII'. Right click on the folder and select SVN Checkout. Leave all of the options at their defaults, except for the URL field. In the URL field put {{{ https://robotics610.googlecode.com/svn/trunk/XII - Competition }}} and click OK. Tortoise will download all of the files in the server's XII folder and put them in your XII folder. The XII project can now be opened in !NetBeans with the Open Project dialog (Ctrl+Shift+O).
===Updating=== It's generally considered unproductive to work on creating something that already exists. If you're working with an older revision of the project, this is likely to happen at some point, when multiple people are assigned a task and a user completes it without informing the others. By updating your project folder, you get the most recent revision, and can avoid unfortunate circumstances like this. To update, simply right click on the folder where your project is (in this case XII) and select SVN Update.
===Committing Code=== When you have finished editing any relevant files, you will want to commit your changes. To do this, right click on the folder where your project is (again, XII in this case) and select SVN Commit. Any files you have made changes to will appear on the lower window. Check them all to make sure they update. When committing, please include a log message that explains quickly the changes you made, so while looking through revisions, it's easy to see at a glance what was changed. This is done in the top message box. After you click OK, an authentication window will pop up. If you are signed into a Google Account, the username is the name of that account, for example patrickwhite@crescentschool.org. Your password can be found [https://code.google.com/hosting/settings here]. If you are on a private computer, I would recommend checking the 'Save Authentication' checkbox because it saves the hassle of looking for the complicated password every time. After clicking OK, your changes will be committed to the repository!
===A Note About Icons=== Tortoise is very useful in that you can differentiate project folders that connect to a repository at a glance, as well as whether you have changed anything since you last updated the folder. If a folder has a green checkmark in the bottom left corner, it is a folder that connects to a repository, and it matches the server's copy. If there is a red exclamation mark in the bottom left corner, it means that you have made changes since checking out or updating code from the server. When you see this try to commit as soon as possible.