Click "Apply and Close" to save your progress. When finished, you should have "Think Java, 2nd Edition" as the active profile, as shown in Figure 10. Then click the "Import" button, and navigate to the Formatter.xml file.
Search for the word formatter, and click "Formatter" under "Java > Code Style". Go back to the Window > Preferences menu (or Eclipse > Preferences on a Mac).
Download the configuration file Formatter.xml (right-click and "Save link as."), and save it under your CS149 workspace folder ( not your Downloads folder). The Eclipse formatter will automatically fix most style errors in your programs. Figure 8 Figure 9 Step 6: Set up Formatter There should be a green check mark to the right of the ThinkJavaCode2 configuration. is your home directory location)Īfter you click the "OK" button, select ThinkJavaCode2 in the list and then click "Set as Default", as shown in Figure 9. Enter the following information shown in Figure 8:
Click "Checkstyle" on the left, and then click "New." on the right. Then in Eclipse, go to the Window > Preferences menu (or Eclipse > Preferences on a Mac). Figure 7 Step 5: Set up Checkstyleĭownload the configuration file Checkstyle.xml (right-click and "Save link as."), and save it under your CS149 workspace folder ( not your Downloads folder). Then click "Restart Now" to apply the changes. When given the security warning, click "Install anyway".
Accept the license terms, and click "Finish". The installation will take a minute or two.
Check the box to install Checkstyle and click "Next", as shown in Figure 7.
For "work with", enter the URL and press Enter. More importantly, it also checks for common programming mistakes, such as empty statements and accidental assignment. Figure 6 Step 4: Install CheckstyleĬheckstyle is a tool that can be used to determine if your source code follows a set of style rules. Typically students create a separate workspace for each course and a separate project for each assignment. This location will likely be different on your own computer.Īn Eclipse "workspace" is a folder (or directory) that contains projects and settings. Notice that /cs/home/stu/ username is the location of your home directory on the CS lab machines. Change the name to CS149 (with no space between CS and 149), as shown in Figure 6. The default location is a directory named eclipse-workspace. When you run Eclipse, it will prompt you to select a workspace location. Figure 4 Figure 5 Step 3: Create Workspace The installation might take several minutes. When asked, select the "Eclipse IDE for Java Developers" package (Figure 5). It's free and open source, and it's widely used by professionals around the world.ĭownload and run the installer for your operating system (Figure 4). Skip this step if you're on a CS lab machine Eclipse is already installed.Įclipse is an integrated development environment (IDE) for building applications based on Java, C/C++, Python, and many other languages. Figure 1 Figure 2 Figure 3 Step 2: Install Eclipse Your version might be a bit newer than the images below. To verify the installation, open a Terminal and type java -version (Figure 3). Run the installer, and follow the instructions (Figure 2). Visit the AdoptOpenJDK website and download OpenJDK 11 for your operating system (Figure 1). Simply run the command: sudo apt install openjdk-11-jdk openjdk-11-source Windows and macOS: Java SE 11 is the current Long-Term Support (LTS) release and is the version installed on our servers and lab machines. The JDK we recommend is OpenJDK, an open source implementation of Java SE (Standard Edition). In order to compile Java programs on your computer, you will first need to install the Java Development Kit (JDK). Skip this step if you're on a CS lab machine Java is already installed.
This page shows you how to install and configure Eclipse on your own computer. Throughout the course, we will use Eclipse as our primary development environment.