Configure Eclipse

Style

  1. Download (right-click Save link as…) the CS200 Java Style XML file: CS200Style.xml which is based on Google Style.
  2. In Eclipse, open Windows > Preferences
  3. In the Preferences window, go to Java > Code Style > Formatter, Click on Import
  4. Select the CS200Style.xml that you downloaded in Step A and make sure it is the Active profile as shown and Apply and Close.
  5. If the following warning message pops up, that is fine. Just click OK.
  6.  Open the Preferences dialog window again and go to General > Editors > Text Editors to see settings such as the following:
  7. Click Apply and Close.

File Encoding

  1. Now, go to Window > Preferences > General > Workspace, set “Text file encoding” to “Other: UTF-8”.  UTF-8 is the standard text file encoding used worldwide.

File Header Comment

  1. In the Quick Access box at the top right of Eclipse, type “code templates”
  2. Select “Code Templates – Java/Code Style”
  3. Select “Comments,” “Files,” then press “Edit…”
  4. Copy and paste the TOP OF FILE COMMENT BLOCK into the box
  5. Hit OK, then Apply and Close
  6. When you create a new class, just check “Generate comments” for the block to be added.
///////////////////////// TOP OF FILE COMMENT BLOCK ////////////////////////////
//
// Title:           descriptive title of the program making use of this file
// Course:          course number, term, and year
//
// Author:          your name
// Email:           your @wisc.edu email address
// Lecturer's Name: name of your lecturer
//
///////////////////////////////// CITATIONS ////////////////////////////////////
//
// https://cs200-www.cs.wisc.edu/wp/syllabus/#academicintegrity
// Source or Recipient; Description
// Examples:
// Jane Doe; helped me with for loop in reverse method
// https://docs.oracle.com/javase/tutorial/java/nutsandbolts/for.html; 
//         counting for loop
// John Doe; I helped with switch statement in main method.
//
/////////////////////////////// 80 COLUMNS WIDE ////////////////////////////////

Dark Theme?

If you prefer Eclipse to have a dark theme, open the Preferences dialog window again and go to General > Appearance to select a theme.

Next Tutorial: