1.2. Setting Up Your Programming Environment¶
Students with synchronous lab sections are encouraged to attend the first week for assistance with this setup process.
1.2.1. Downloading and Installing Eclipse¶
This course teaches programming using Java. We will use the Eclipse Integrated Development Environment for code development in class, including all examples shown. The instructions here include the user libraries necessary for assignments in this course, and programming assignments will not compile without these.
Note
Note: this setup involves multiple steps and it’s not uncommon for students to miss something their first time through. If you’ve installed everything but can’t get any code to run at all, it’s good to try uninstalling Eclipse and just installing it again.
Click on the Download link in the box at the top that matches your computer.
Which version of Eclipse should I download? 32 or 64-bit? x86_64 or AArch64?
It is important to download the correct version of Eclipse for you computer’s operating system.
For Windows: Review this page to figure out if you have 32-bit or 64-bit Windows, and then download the x86_64 for 64-bit Windows, or the x86 for 32 bit windows.
For Mac: Figure out what processor you have in your Mac, and then download the Mac x86_64 version for Intel processors, or AArch64 for the Apple processors.
After the download is complete, follow the installation instructions beginning at step 2 on this page, selecting IDE for Java Developers when prompted. You will also need to accept terms and conditions.
Start Eclipse. ( If you are on a Mac, you need to set System Preferences->Security and Privacy to allow apps downloaded from locations other than the Mac App Store.)
The first time you start Eclipse, you’ll be asked to specify a location for the Eclipse Workspace; this is where Eclipse will keep your programming projects. You can either use the default recommendation or place it elsewhere on your file system. Check the Use this as the default and the do not ask again option, so Eclipse will not ask you every time you start it, and click Launch.
You may see a notice about a requirement needing an update. Click the checkbox Remember my Decision then select Install.
6. The initial Eclipse startup screen has a Welcome tab with an Overview, Tutorials, Samples, and a “What’s New” section.
Feel free to explore the options and then close the Welcome tab by clicking the “X” control to the right of “Welcome” near the top of the window to proceed to the Workbench.
1.2.2. Configuring Eclipse¶
1.2.2.1. Installing the Webcat Plugin¶
Now we need to install an additional plug-in to make some common tasks in this course easier.
Open the Help menu and select Install New Software…:
In the Work with: field, paste the following URL and press Enter (or press “Add”): http://web-cat.org/eclipse
Click the check boxes next to “Web-CAT Electronic Assignments” and “Web-CAT Java Development Extras”, and click Next.
If the Install Remediation Page appears, then select the second radio button to “Update my installation to be compatible with the items being installed”.
If the Trust dialog appears, click on Select All followed by Trust Selected.
Check “I accept the terms of the license agreements” and then click Finish.
Wait while the plug-in is being downloaded and installed. This may take a few minutes. You may get a warning about installing unsigned code during the installation. Click OK (or “Install anyway”) to continue the installation.
When the installation is complete, Eclipse will notify you that it should be restarted in order for the changes to take effect. Click Yes to do so.
1.2.2.2. Plugin Settings¶
Now that you have installed the Web-CAT plugin, you can tell it where to find and submit assignments.
Once Eclipse has restarted, select Window -> Preferences… (or on MacOS, Eclipse -> Settings…) from the menu.
Select Configured Assignments from the left panel.
Copy and paste the following two URLs into the panel. (If the line gets wrapped, make sure you don’t accidentally put any spaces in it.)
Download URL
https://courses.cs.vt.edu/cs2114/assignments.xml
Submit URL
https://web-cat.cs.vt.edu/Web-CAT/WebObjects/Web-CAT.woa/wa/assignments/eclipse?institution=VT
Click the Apply and Close button to save your changes and exit the preferences window.
1.2.2.3. Customizing Formatting and Style Preferences¶
One of the formatting guidelines expected throughout this course is to use spaces instead of tabs in your code. This makes your code more portable between users and environments. To make this easier, we provide a code style sheet that you can import into your Eclipse settings. Once installed, you can use these keyboard commands to automatically format your code:
- Windows: CTRL + SHIFT + F
- Mac: Command + Shift + F
Remember to format your code before submitting to Web-CAT.
Right-Click and “Save As…” to download to download the stylesheet: https://courses.cs.vt.edu/cs2114/vtcseclipsestyle.xml
To install:
- Mac:
Eclipse->Settings->Java->Code Style->Formatter->import the above file, then click OK
- Windows:
Window->Preferences->Java->Code Style->Formatter->import the above file, then click OK
1.2.2.4. Customizing Preferences¶
To tailor Eclipse’s settings and code formatting choices for this course, download the following preferences file to your computer by right-clicking the link and choosing “Save As…” or “Save Link As…”:
It doesn’t matter where you save it, but do remember where it is saved.
To install:
From Eclipse’s menu, choose File -> Import….
In the Import dialog, click the arrow in front of General and select Preferences.
Click Next to move to the next page of the dialog.
Click the Browse button to the right of the field labeled From preferences file:, and find the vtpreferences.epf file you downloaded. Then click Finish to import these settings.
1.2.2.5. Adding CS2 Support Projects¶
Follow Along and Engage
Labs, projects, and sample code make use of one or more of the following CS 2114 Support Projects (CS2-Support, CS2DataStructuresLib, CS-GraphWindowLib). You can download the support projects via eclipse using the blue down arrow icon or using the Project Menu and selecting “Download Assignment…”.
1.2.2.6. For Future Reference As Needed:¶
Follow Along and Engage
To use all of our student configurations, it’s easiest to use Java 8. If you need help with this, watch the video below.
You’re all set to begin the assignments!