Eclipse is an integrated development environment (IDE) which allows programmers to create, develop, test and debug programs. It includes a number of useful tools which aid the development process, such as a WYSIWYG (what you see is what you get) editor, a GUI interface, a debugger and much more.
Getting started in Eclipse
- Eclipse is installed on the ugrad machines and can be accessed through the Xfce Menu (left-most icon with a blue X in the button bar at the bottom of the screen) under Development.
- After Eclipse opens, you should get a Welcome window that then takes you to a Package Explorer view.
- If you do not get a Package Explorer view, then Eclipse is not configured properly and you will need to reconfigure Eclipse. It is best to let your TA do this, or ask them for help.
- In Package Explorer view, select File > New > Java Project from the menu bar to begin creating your first Java project.
- For the project name, enter Exercise1a, then click the Finish button.
- An Exercise1a directory will now be created inside your workspace directory (inside your home directory).
- To add a class to the project, select File > New > Class from the menu bar.
- Name: Exercise1a
- Method stubs: public static void main(String args)
- Click Finish
- You should now have an editor window into which you can enter your Java code.
- After entering your code, select File > Save (or press Ctrl+S) from the menu bar to save your work.
- Ensure the Exercise1a project or class is selected is selected, then select Project > Build All from the menu bar to compile the program (or press Ctrl+B).
- If there are syntax errors, they will be displayed in the Problems window at the bottom of the Eclipse frame. You may need to click the Problems tab. An x in a red box will also be displayed beside the line of code that contains the syntax error.
- To run the program, select the Exercise1a.java editor, then select Run > Run as > Java Application from the menu bar. The program runs and the output is directed to the Console window at the bottom of the screen.
Back to top
If Eclipse is not configured properly, or you get some "weird" problems with Eclipse, you may need to reinstall your Eclipse workspace. For example:
- Being unable to create a project, even though you are doing everything correctly.
- Not being able to open projects.
- Noticing that other normally present Eclipse functionality is missing.
Ask your TA first, as there may be an easier and less potentially dangerous fix than the following.
- Ask a TA for help; it's not recommended you do this on your own
- Save all your work in Eclipse, then close Eclipse
- Back-up your workspace (this means make a copy of the entire workspace directory)
- Delete your original workspace (which you've made sure to back-up!)
- Download workspace.zip (66kb) to your home directory
- Navigate to your home directory, unzip workspace.zip by double-clicking on workspace.zip and extracting the files. (Hopefully you will quickly see how to extract files. If not, please ask a TA.)
- A new workspace folder will be created
- Copy over any Eclipse project directories you want to use from your backed-up workspace into the new workspace directory
- Then import each project into Eclipse
Back to top
First Year Eclipse Tutorials (PDF, 1.4mb)
- Copying a class
- Renaming a class
- Changing an applet's width and height
- Handling infinite loops
- Importing an eclipse project into your workspace
- Eclipse features: refactoring and formatting code
- Installing Eclipse at home
- Installing Eclipse plugins
Eclipse & Java tutorials (Sourceforge)
Exception in thread "main" java.lang.NoClassDefFoundError (in the Problems View)
You may need to build your project first.
Access restriction: The field in from the type Keyboard is not accessible due to restriction on required library C:\Program Files\Java\jdk1.6.0_31\jre\lib\ext\UofAC114.jar
You need to configure Eclipse like it is in the lab. See the tutorial section on Configuring Eclipse Like in the Lab for more details.
Back to top
Do I have to buy Eclipse if I'm registered in this course?
Absolutely not. In fact, no one has to buy Eclipse; it can be downloaded for free. If a student wishes to download and install Eclipse, that's entirely their own decision. See the tutorial for Installing Eclipse at Home for more information on downloading and installing Eclipse.
What if I don't have Eclipse at home?
If you do not have a home computer with Eclipse installed on it, you will need to do one of the following to program in Java:
- Come to campus to use the computers in the labs (Eclipse is installed in the lab rooms that we use for the course)
- Program in Java at home using something other than Eclipse (like Notepad and the javac and java command-line commands)
Note: Even if you do your Java programming at home, you are still required to get your Exercises and Assignments to work on the lab computers.
If I decide to buy Eclipse, where can I buy it from and how much does it cost?
You do not have to buy Eclipse, as you can download it for free from www.eclipse.org, and install yourself. See the tutorial for Installing Eclipse at Home for more information on downloading and installing Eclipse.
Which version of Eclipse are we using in the labs?
The labs are using a version of Eclipse the same as or close to the one specified in the installation tutorial. See the section on Configuring Eclipse Like in the Lab for more information on how Eclipse is set up in the labs.
I have found another version of Eclipse - what's the difference between these versions?
For current information about Eclipse versions and their differences, please visit theEclipse site. Also read the tutorial section on Configuring Eclipse Like in the Lab for more information.
I have downloaded Eclipse, but I'm having troubling installing it. Where can I get help?
If you have problems, please ask your TA; if they can help, they will. You can also reference the Eclipse tutorials or the Eclipse website. Please note that you are ultimately responsible for solving problems on your home computer.
Is Eclipse used in any other Computing Science courses?
CMPUT 114 and CMPUT 115 both use the same version of Eclipse. CMPUT 301 also uses Eclipse, although the version and its set up may be different. It may also be used in other courses.
If I have Eclipse on my computer at home, will my programs work on the computers in the labs?
Probably, although there is a good chance that you may need to perform some tweaking and perhaps some conversions in order to make your code work in our lab environment.
If you have problems, please ask your TA; if they can help, they will. Note that you are ultimately responsible for solving problems on your home computer.
- If you choose to work from home, it is your responsibility to ensure that your code works in our labs. You will lose marks if it doesn't work
- Please bring your completed code into the lab well before the due date and test it thoroughly on our lab machines before you submit it for grading
- Read the tutorial section on Installing Eclipse at Home for more information
Back to top