Contents [0/10] |
Using Eclipse: Install Java, Eclipse and Graphviz [1/10] |
There is a video walking through these steps on windows: Java/Eclipse/Graphviz installation
Quick links:
Step-by-step:Install Java.
You must have Java 8 or better. (The java version provided by Apple is not sufficient.)
You can download Java from Oracle
Get the JDK, also known as the Java SE Development Kit
.
As long as you have a 64 bit machine, you should get the 64-bit version, rather than the 32-bit version.
The java installer is an executable file, and you should run it.
Download Eclipse IDE for Java Developers
from here:
Eclipse Downloads
You must get Eclipse Luna (4.4) or later. Older versions will not work.
You should get Eclipse IDE for Java Developers
.
The main difference between versions is the number of
packages that come pre-installed. This is the
smallest version that has everything we need.
Eclipse comes as a zip file. You should unzip it to C:\Program Files
on windows
and /Applications
on OSX. If you have trouble on
windows, try unzipping to a different directory.
Download and install Graphviz
from here:
Graphviz
Using Eclipse: Install code for this class [2/10] |
There is a video walking through these steps on windows: SE450 workspace movie
Quick links:
Step-by-step:Create a folder structure for course materials
For example, you might use:
C:\Users\myname\Documents\DataStructures
Download the zip file for the class: Code examples ZIP
Unzip the file into the folder for class.
This should create a folder called workspace
.
The workspace
folder should contain se450
.
The se450
folder should contain lib
, src
, and maybe some other things.
Verify that the folder hierarchy looks like this:
C:\Users\myname\Documents\DataStructures\workspace C:\Users\myname\Documents\DataStructures\workspace\se450 C:\Users\myname\Documents\DataStructures\workspace\se450\lib C:\Users\myname\Documents\DataStructures\workspace\se450\src
On my machine, I have the following:
Start eclipse. When it prompts you for a workspace, select your workspace
folder.
C:\Users\myname\Documents\DataStructures\workspace
DO NOT SELECT THE se450
FOLDER!
In eclipse, navigate to
File > New > Java Project
In project name
type se450
. and then click the finish
button
Using Eclipse: Enable JUnit, Disable some warnings [3/10] |
Enable JUnit.
Disable warnings for unnecessary code. LEAVE ALL OTHER WARNINGS AT THEIR DEFAULT VALUES.
Go to "Eclipse/Window" > "Preferences" > "Java" > "Compiler" > "Errors/Warnings" > "Unnecessary code" Set the following to "Ignore" "Value of local variable is not used" "Unused private member"
On windows, the "Preferences"
option is under
"Window"
instead of "Eclipse"
Using Eclipse: Downloading homework [4/10] |
Follow these instructions:
Using Eclipse: Uploading homework [5/10] |
After you have completed the assignment, save your work in eclipse and then follow these instructions:
Using Eclipse: Uploading a manually created zip file [6/10] |
Some of you are not using eclipse and so are submitted zip files. That's fine, but please be sure that the zip files have the correct folder structure:
myhw1/ |-- InventorySet.java |-- InventoryTEST.java |-- Record.java |-- RecordTEST.java |-- VideoObj.java |-- VideoTEST.java
Please unzip your file and make sure it has this structure. There should not be more or fewer directories
Here are some correct examples from unzip -l
CORRECT (this is what eclipse creates): Length Date Time Name -------- ---- ---- ---- 25 09-22-15 13:50 META-INF/MANIFEST.MF 2969 09-22-15 13:42 myhw1/InventorySet.class 4352 09-22-15 13:41 myhw1/InventorySet.java 936 09-22-15 13:42 myhw1/RecordTEST.class 396 09-22-15 13:41 myhw1/RecordTEST.java 2506 09-22-15 13:42 myhw1/InventoryTEST.class 2749 09-22-15 13:41 myhw1/InventoryTEST.java 1773 09-22-15 13:49 myhw1/VideoObj.class 2978 09-22-15 13:49 myhw1/VideoObj.java 1095 09-22-15 13:42 myhw1/Record.class 1590 09-22-15 13:41 myhw1/Record.java 1949 09-22-15 13:47 myhw1/VideoTEST.class 1549 09-22-15 13:47 myhw1/VideoTEST.java -------- ------- 24867 13 files CORRECT (This is what a manual zip should create): Length Date Time Name -------- ---- ---- ---- 4682 09-21-15 21:18 myhw1/InventorySet.java 2800 09-21-15 21:41 myhw1/InventoryTEST.java 1590 09-20-15 14:07 myhw1/Record.java 397 09-20-15 23:02 myhw1/RecordTEST.java 3593 09-20-15 21:16 myhw1/VideoObj.java 3261 09-20-15 20:55 myhw1/VideoTEST.java -------- ------- 16323 6 files
Here are some incorrect examples from unzip -l
NOT CORRECT (too many directories!): Length Date Time Name -------- ---- ---- ---- 4682 09-21-15 21:18 se450/src/myhw1/InventorySet.java 2800 09-21-15 21:41 se450/src/myhw1/InventoryTEST.java 1590 09-20-15 14:07 se450/src/myhw1/Record.java 397 09-20-15 23:02 se450/src/myhw1/RecordTEST.java 3593 09-20-15 21:16 se450/src/myhw1/VideoObj.java 3261 09-20-15 20:55 se450/src/myhw1/VideoTEST.java -------- ------- 16323 6 files NOT CORRECT (too few directories!): Length Date Time Name -------- ---- ---- ---- 4608 09-21-15 22:49 InventorySet.java 3209 09-21-15 22:55 InventoryTEST.java 1590 09-16-15 19:36 Record.java 396 09-16-15 19:36 RecordTEST.java 3939 09-21-15 22:08 VideoObj.java 3449 09-20-15 15:08 VideoTEST.java -------- ------- 17191 6 files
Using Eclipse: Installation problems? [7/10] |
If you have errors after installing eclipse and the code from class, please watch this: Eclipse problems
Uninstall everything and try again.
If that does not work, email me ASAP. Don't waste time trying to fix a broken eclipse install.
eclipse is messed up.
Here is some advice that has worked in the past.
It has happened for some students that suddenly eclipse shows a bunch of errors, whereas previously everything was fine. First thing to try is to clean all projects using Project -> Clean Then look at the previous slide to see if it matches your situation. You maybe can adjust the compiler settings to get it to work. If you still have problems, you should just start with a fresh workspace. Exit eclipse. Using the finder, go to your workspace. Rename it to oldworkspace and create a new folder called "workspace" Inside workspace, create a new folder called "se450" Move the following folders from oldworkspace/se450 to workspace/se450 lib data src Now start eclipse in the new "workspace". It should be as though you are starting eclipse for the first time. Follow the instructions provided earlier to add the "se450" project and to turn off the warnings for unused variables and private fields.
Some more advice that has worked in the past.
It may happen that eclipse shows compiler errors in the code that I have provided. For example, it may say something like: -- The method printf(String, Object[]) in the type PrintWriter is not applicable for the arguments (String, int, long) -- The method put(ThreadReference, Stack<HashMap<LocalVariable,Value>>) in the type HashMap<ThreadReference,Stack<HashMap<LocalVariable,Value>>> is not applicable for the arguments (ThreadReference, Stack<Object>) These are compiler issues, indicating that you are not using the correct language compliance level. To fix this, do the following: Check that Project Specific Settings are NOT checked in the following places Project -> Properties -> Java build path Project -> Properties -> Java compiler Then check Preferences -> Java -> Compiler Preferences -> Java -> Installed JREs to make sure that compliance level is set to 1.8 and that a Java SE 8 runtime is checked. Then got to Project -> Clean and clean all projects.
Using Eclipse: What to do if you cannot see package explorer in Eclipse [8/10] |
To show the package explorer, do this:
Once it is showing, you can adjust the view using the buttons:
Using Eclipse: Run problems? [9/10] |
You may get this Run As
box in eclipse, like this:
Or this:
If so, then try selecting the program you want to run in the package explorer and using a right click to bring up a context menu. You can select run from there:
The run button is context sensitive in eclipse. It's behavior varies depending upon where the mouse was last clicked and what the last command to be run was. This problem usually sorts itself out. So try the run button again later.
Using Eclipse: Useful stuff in eclipse [10/10] |
To stop copy paste from inserting bogus imports
"Preferences" > "Java" > "Editor" > "Typing" > (Under "When Pasting") uncheck "Update Imports"
To get autocompletion when typing characters other than .
"Preferences" > "Java" > "Editor" > "Content Assist" > (Under "Auto Activation") paste the following in the textfield for "Auto activation triggers for Java" ._abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 Use uparrow/downarrow to go through the suggestions Use enter/return to accept a suggestion Use escape to dismiss the suggestions
Revised: 2008/09/22 19:32