Description
Overview
Purpose: Prepare your computer for authoring and running Java programs.
Task: Install the Java Development Kit and DrJava.
Learning Outcomes: 5 *
Time: Complete this activity in Week 1 and submit before or during your Week 2 tutorial.
Resources: MyLO: Instructions and Information/Software you will need
Online Mini-lectures: Getting Prepared
Submission Details
Upload the following to the MyLO submission folder for this task:
A screenshot of the command window (Windows) or terminal (Mac) showing that the JDK has been installed A screenshot of the DrJava window
Assessment Criteria
A Completed submission will:
• Show that theJDK has been installed correctly
• Show the DrJava window with the given small program visible and with the correct amount of indentation, and the JDK compiler selected (displayed at the bottom right)
Instructions
Work through the following sequence of activities to install the Java Development Kit ODK) and DrJava on your computer, and to document that it worked. Refer to the instructions and links given in Software you will need in the Instructions and Information section of MyLO to obtain each piece of software.
Note: If you do not have access to a computer on which to install the required software then email the unit coordinator to discuss adjustments to this task.
Tip: A folder is also called a ‘directory, although that terminology is largely limited to Linux systems now.
2. Install the JDK.
o From MyLO, download theJDK suitable for your computer o Run the installation package
3. Open a command window (on Windows) or terminal (on Mac) and enter the following command, followed by pressing Enter:
java -version
This java -version command runs the Java runtime engine (which is used to execute [run)) Java programs. By passing it the command line argument -version we’re asking it instead to display its version number.
Note: To open the command window on Windows open the Start Menu (or Start Screen) and type cmd and press Enter. To open the terminal on Mac either use its icon (if you’ve got it in the dock) or open Spotlight, type terminal and press Enter.
4. Take a screenshot of the command window/terminal showing the command and its output and save it to your workspace for this task. You will submit this image later.
Tip: You can use utilities like Greenshot to make the task of capturing and saving images of parts of your screen easier.
If you’ve installed a screenshot utility and you’re on Windows then the key combination Alt + PrntScrn should capture an image of the currently active window and then bring up the utility’s menu giving you the option to save it.
5. Next, download DrJava from MyLO. This is a self-contained program (wrapped up as a Java ARchive, .jar) so doesn’t have an installation package. Instead, create a folder on your computer and move the .jar file into it.
Tip: As I’m on Windows I created C: Apps to hold non-standard programs and utilities, and a subfolder called DrJava under that, but anywhere other than the desktop or downloads folder is OK.
Create a shortcut to the file somewhere you can find it easily to make it quick to start DrJava whenever you need it.
7. Type (don’t copy-paste this time) the following small ‘program’ into the editor window. This will verify that the indentation level and font size have been set correctly.
public class Test { / * Does nothing * /
Tip: If everything is working as expected you’ll see the / * Does nothing */ be automatically indented by four spaces. If it isn’t, first check that you’ve got the correct opening brace { and if that’s OK then place the cursor immediately after it and press Enter. (DrJava will sometimes ‘helpfully’ ignore your attempt to enter a tab, whenever it doesn’t believe that one is required, but its judgement is not always correct.)
Note: The ‘program’ doesn’t do anything, and will not run. It is also missing indentation that would make it more readable, but the DrJava editor should add that for you as you type. The next task, 1 .2PP Hello World, will take you through the steps to create a program that actually does something.
8. Take a screenshot of the DrJava window showing the do-nothing program and the selected compiler. Submit both the screenshot of the command window from before and this screenshot to the 1 .1 PP Assignment submission folder on MyLO.
Congratulations! You’ve finished the first pass-level task.
Reviews
There are no reviews yet.