Eclipse Guide for CS162
You can use any IDE for Nachos. Karl recommends Emacs. Eclipse is another good tool, but it requires some setup. Here are some tips that have been collected; please send any tips you have.
Nachos has a directory/package structure that Eclipse doesn't like very much, so you have to be careful when creating the project so that Eclipse can find each package. (Otherwise it might see "threads" instead of "nachos.threads".) You should create the project in the parent directory of your Nachos source tree, i.e. the directory containing the directory "nachos".
One way to do this is:
- Create a new empty directory (e.g. cs162)
- Unpack nachos in this directory, so that you have cs162/nachos
- In Eclipse, "Create project at external location" and enter the parent directory of nachos (in this example, cs162).
Nachos unfortunately has a function named assert, which became a Java keyword in Java 1.4. Eclipse by default will use Java 1.4 compatibility which disallows it as a function name. To tell Eclipse to allow "assert" as not-a-keyword: Open preferences → compiler compliance & class files; change all the compatibility options from 1.4 to 1.3, and change "assert as keyword" to "ignore".
The Subversion plugin for Eclipse is Subclipse.
To install from Eclipse: Help → Software Updates → Find and Install → Search for new features and Install
To add a new repository: Window → Open Perspective → Other → SVN Repository Browser. Right click on blank spot in browser and choose New → Repository Location.
To export your current project in your PC onto the repository, just switch perspectives back to "Java" perspective (clock on Java near top right corner of eclipse window), right click on your nachos project and choose: Team → Share Project.
Background color on instructional Sun machines
To change the background color go to preferences → window → java editor → background color.
The main class to run is nachos.machine.Machine.