Eclipse Setup

Posted on by admin

This project is a software installation of Eclipse SDK for Windows. With this setup, Eclipse v3.2.1 is easy install for Windows. Ce petit programme permet l'installation facile, de Eclipse. Step 1: Installing and configuring Eclipse Step 1a: Download. NOTE: if you used Eclipse before, you may have an older version installed. If so, we strongly recommend you uninstall it and install the latest version for maximum compatibility. Setting up an IDE is always going to be a personal thing, but here’s what we think is a standard starting point for Java development in Eclipse. Firstly and most importantly, we use the Google. Create a shortcut on your desktop to the eclipse.exe file in this eclipse folder: On most Windows machines, you can Right-press the file eclipse.exe; Drag it to the desktop. Release the right button. Click Create shortcut here. Now you are ready to perform a one-time only setup of Eclipse on your machine.

Setup

DISCLAIMER: Don't hold me accountable for any bad advice or incorrect information provided here. Use this information at your own risk. I was barely able to hack it together myself and there are still a few details I am not 100% clear on.

For more details about installing MSYS2 check out Install gcc compiler on Windows with MSYS2 for C/C++.

Trying to get an open source toolchain configured in Windows for C++ can sometimes be a headache. In Windows, you can simply install Visual Studio and use the Microsoft C++ compiler, but you may want to use the free GNU compiler (g++) instead. This will outline the process for getting a simple C++ toolchain ready in Windows using Eclipse as an IDE. This guide focuses on the 64 bit version only.

It is important to note that if you install all the MSYS2 development tools first and add the directories to your PATH before running Eclipse and creating a workspace, then Eclipse will be able to find the compiler and tools without having to explicitly set and include directories and will generally work better. I highly recommend setting up the MSYS2 tools and updating your PATH before loading Eclipse.

The toolchain being used is:

  • Eclipse C++ (currently Oxygen)
  • MSYS2, which provides the MinGW gcc/g++ compiler.

MSYS2

For a compiler we want to use g++, part of the GNU compiler collection (gcc). To get this on Windows we want a minimal system (MSYS) with minimalist GNU for Windows (MinGW) setup. You could use the older MinGW+MSYS tools, but I recommend using MSYS2, which is all I will covere here. MSYS2 comes with the pacman package manager, the same one Arch Linux uses. Simply download the installer and then use the 'MSYS2 MSYS' icon that it creates in the start menu, or run it manually from C:msys64msys2.exe.

After getting in to the MSYS2 bash shell, update everything with:

Eclipse Setup Proxy

Then install the base development tools like make and autoconf with the base-devel package and

Optional: Add MSYS2 executables to your Windows PATH

If you want to access everything from your Windows Command Prompt, including vim, pacman, g++, make, and everything else, then add these to your PATH:

Eclipse C++

Since you already have the compiler toolchain installed and available, you can compile C/C++ project and get coding, but you will likely want to set up an IDE to make things easier. There are many options including NetBeans, Qt Creator, CodeBocks, CLion, Visual Studio Code, Sublime Text, Atom, vim, emacs, etc. Since we are using the free GNU toolchain that is available on several platforms, I recommend using an IDE that is also cross-platform, so you can use the same IDE+compiler across Windows, Mac, and Linux. For this tutorial, I chose Eclipse. It is a very mature IDE, has a good debugger, is heavily customizable and supports many other languages if you choose to commit to it and use it for other languages.

When choosing a project, choose MinGW as the compiler.

Configure environment variables

First set up your environment variables so Eclipse knows where to look for things. It might try to auto detect some of these, but you want to at a minimum make sure your PATH variable includes the directories with make and g++.

  • C:msys64mingw64bin
  • C:msys64usrbin

Project->Properties->C/C++ Build->Environment:

Eclipse

Note the path var may already be set if you manually updated your path earlier to add the bin directoriess.

At this point you should be able to compile your program, but the code editor will tell you it can't resolve the standard library symbols like std::cout.

Set up include paths

Eclipse Setup

To fix the unresolved references, Eclipse needs to know where to look for the header file. Have it include the header file for the standardb C++ library in MinGW, by adding the following include path:

Project->Properties->C/C++ Build->Settings->g++ compiler->Includes

Optional: Specify C++ Standards Level

To specify the language level, go to Project->Properties->C/C++ Build->Settings->GCC C++ Compiler->Dialect and choose the appropriate language level, like -std=c++0x

Optional: 32-bit toolchain

To install the 32-bit toolchain, run:

And add the 32-bit toolchain path to your PATH environment variable.

Optional: CMake

Make is already installed with the base-devel package, but if you want to use CMake you need to install it separately from base-devel and toolchain.

Enjoy

At this point, you should have a working toolchain to compile C++ on Windows using Eclipse!

Eclipse Setup Git

Step 0: Installing Java

Before you start installing Eclipse, make sure that you have the Java Development Kit (the JDK) installed on your system. If you're not sure, it's safe to just try installing it again. (If you already have the JDK installed, installing it again will just update you to a slightly newer version.)

To download the JDK, go to this page and download the appropriate file for your operating system.

Note: while the latest version of Java is Java 9, we strongly recommend you use Java 8 in this class. While our course projects in theory work with Java 9, they have only been tested with Java 8. The link above will take you to the Java 8 download page.

Step 1: Installing and configuring Eclipse

Step 1a: Download

NOTE: if you used Eclipse before, you may have an older version installed. If so, we strongly recommend you uninstall it and install the latest version for maximum compatibility.

You can download Eclipse at eclipse.org/downloads. The latest version, as of time of writing, is Eclipse SimRel.

Eclipse setup git

Step 1b: Installation

  1. Run the Eclipse installer. You should see a window like the one below; Select the first 'Eclipse IDE for Java Developers' option.

  2. After that point, you can keep hitting 'yes' and select all the default options (unless you want to change something).

    You should eventually see a screen like this. Click the 'Launch' button.

    Note that there are some third party libraries that we use, such as JUnit, that are included in the projects and managed with Gradle; see the project import guide for more details.

Step 1c: Configuration

  1. When you run Eclipse, it'll ask you where you want your workspace to be (see screenshot below for example). Your workspace will be the location where Eclipse will add any new projects you create. You can change the location of the workspace if you want: just make sure you remember what you picked.

  2. Once you're done, you should see a 'Welcome' screen like below. Close the 'welcome' tab to open the regular editor.

  3. Next, select 'Windows > Preferences' (PC) or 'Eclipse > Preferences' (Mac) in the menu. Then, select 'Java > Installed JREs':

  4. Click the 'Search' button and select the 'Java' folder. This folder should contain your installed JRE and JDK. (If it contains only the installed JDK, that's also ok). You can probably find this folder located at:

    • Windows: C:Program FilesJava
    • Mac: /Library/Java

    For example, on Windows:

  5. After hitting 'ok', you should see a screen with a line for either both the JRE and the JDK, or just the JDK. Select the line for the JDK:

  6. Click the 'Apply and close' button.

  7. Eclipse, by default, contains a fair degree of clutter. If you want to minimize the clutter, feel free to close the 'Task List' and 'Outline' tabs/views to the right.

Step 2: Configuring checkstyle

We will start by installing a plugin named 'checkstyle', which when run will check your code for different style issues.

Step 2a: Installing the plugin

  1. In the menu bar, click 'Help' > 'Eclipse Marketplace'

  2. Search for 'checkstyle' (the search bar is near the upper-left). You should now see something like this:

  3. Select the option labeled 'Checkstyle Plug-in 8.x.x'. (The exact version number may be different from our screenshot). Click the 'Install' button in the lower-right of that option. You should ignore any other plugins that show up.

    At some point, Eclipse will ask you to accept some license agreements. Accept them, and move on.

  4. Once you are done, Eclipse will tell you that it needs to restart to make sure all changes take effect. Click the 'Restart Now' button.

Eclipse Setup Maven

Step 2b: Loading the CSE 373 style rules

  1. Once Eclipse has finished restarting, we need to load our CSE 373 specific rules.

    Start by downloading and saving our checkstyle rules by clicking 'File' > 'Save as'. Make sure you remember where you saved the file! You probably want to save these rules someplace on your computer that's stable to make sure you don't delete it by accident later.

    (Note: if you previously had the checkstyle plugin installed before starting this class, you will most likely need to update it so that it can understand our rules file.)

  2. In the menu bar, click 'Window' > 'Preferences' (PC) or 'Eclipse > Preferences' (Mac). Navigate to the 'Checkstyle' option. You should see a window that looks like this:

  3. Click the 'New...' button. In the window that appears...

    • Set the 'Type' to 'External Configuration File'.
    • Set the 'Name' to 'CSE 373 Style' (or any other name you want).
    • Set the 'Location' to wherever the XML file you just downloaded is located.
    • Check the 'Protect Checkstyle configuration file' option at the bottom.

    Your screen should look like this:

  4. After clicking 'OK', you should now be back to the 'Preferences' window. Select the configuration we just uploaded, and click the 'Set as Default' button. Your screen should now look like this:

  5. Click 'Apply and Close'.

Step 3: Adjust Eclipse defaults

Step 3a: Enable stricter generics checks

The next step is to configure Eclipse so it catches a common generics-related issue:

  1. In the menu bar, click 'Windows' > 'Preferences' (PC) or 'Eclipse > Preferences' (Mac)

  2. Within the left sidebar, expand 'Java' > 'Compiler' > 'Errors/Warnings'.

  3. Within that window, expand the 'Generic types' section and change the 'Usage of a raw type' option from 'Warning' to 'Error'. After making these changes, your screen should look like this:

  4. Click 'Apply'.

Step 3b: Indent using spaces

A common point of contention among programmers is whether we should indent code using the t character, or by using some number of spaces instead. Personally, we don't really care, but the code we've provided you consistently uses 4 spaces per indent.

Unfortunately, Eclipse defaults to using the t character instead. This is annoying because it causes the indentation in your codebase to be inconsistent. The next step is to modify Eclipse so it matches our class standard.

  1. At this stage, you should still have the window from step 3a open. If you closed it by accident, reopen it by clicking 'Windows' > 'Preferences' (PC) or 'Eclipse > Preferences' (Mac) from the menubar.

  2. Within the left sidebar, expand 'Java' > 'Code Style' > 'Formatter'. You should see a window like this:

  3. Click the 'Edit' button, in the upper-right corner of the screen.

  4. In the window that appears, edit the Profile name in the top of the screen to 'CSE 373 Styles' (or something similar).

  5. Next, in the 'Filter' input area type 'tab'. You should see the 'Tab Policy' option. Change it to 'Spaces only.' Your screen should look like the following:

  6. Click 'Ok'.

  7. Click 'Apply and Close'.

Step 4: Adding SSH key to access Gitlab

Eclipse Setup Svn

Step 4a: Add SSH key to Eclipse

  1. In the menu bar, click 'Windows' > 'Preferences' (PC) or 'Eclipse > Preferences' (Mac)

  2. Within the left sidebar, expand 'General' > 'Network Connections' > 'SSH2' and click he second section named 'Key Management' in the menu bar. You should see a window that looks like this:

  3. Click the 'Load Existing Key...' button and see if there is a file named 'id_rsa' listed. If there is, select the file and click 'Open'. If not, click 'Cancel' and click the 'Generate RSA Key...' button.

  4. If you want to add a password for better security, do so in 'Passphrase:' and 'Confirm passphrase:' boxes.

  5. If you clicked 'Generated RSA Key..' 2 steps ago, click 'Save Private Key...'. Otherwise skip to the next step.

  6. Click 'Apply'.

Eclipse Setup For Windows 10

Step 4b: Adding your SSH key to Gitlab

Eclipse Setup Guide

If you did not generate a new SSH key and you have already entered this SSH key into Gitlab, you may skip this step.

  1. Copy your ssh key from the large white box in the 'Preferences' window.

  2. Go to Gitlab at https://gitlab.cs.washington.edu and sign in with your CSENetID if you have one, or UWNetID if you don't. You all should have access to Gitlab, but if you don't for some reason, email the course staff ASAP.

  3. In the upper right hand corner, click the silhouette and click 'Settings'. On the 'User Settings' page, click the 'SSH Keys' tab, which appears on the left hand menu bar.

  4. In the 'Key' text box, paste the SSH key that you copied from Eclipse.

  5. Create a nickname your this key, '373_Eclipse' is a good option, and click the 'Add Key' button.

  6. You can now log out of Gitlab and return to Eclipse.

  7. In the open 'Preferences' window, click 'Apply and Close'.