Using This PowerPoint This PowerPoint presentation assumes your Computer Science teacher has...

Preview:

Citation preview

Using This PowerPointThis PowerPoint presentation assumes your Computer Science teacher has provided you with the InstallingJava folder, which contains the necessary files to install the JDK (Java Development Kit) and jGRASP.

The Need for File ExtensionsIn this class, we will frequently be working with multiple files that have the same name, but have a different extension. See Java0408 below:

In the next several slides, there are 3 different sets of directions for showing file extensions:

1) Windows 72) Windows 83) Mac

Open any window.Click Organize.

ClickFolder and search options.

Click View

Remove this checkmark.

Click OK.

Now, file extensions like .docx, .pptx, .exe, .java, .html, .bat and .class will show up.

Select Desktop.It is the tile in the lower-left corner.

Open any window and click View.

Check File name extensions.

Go to Finderand select Preferences.

Select the Advanced tab and checkShow all filename extensions.

Frequent JDK UpdatesThis PowerPoint presentation was created in August 2014.

At the time, the latest version of the JDK was Java Version 8 Update 11.

It is very likely that you will use a newer version of the JDK when you install.

There will only be a slight difference between the appearance of your screen and this presentation.

Open the appropriate folder:Windows or Mac.

Double Click the appropriate JDK.

For 32-bit Windows

For 64-bit Windows

For Mac

How do I know if my Windowscomputer is 32-bit or 64-bit?

Right-click Computer and select Properties.

Look atSystemtype:

NOTE: if you do not have a Computer icon on your desktop, you can also

right-click it in the Start Menu.

In Windows, you will be asked for permission to install. Go ahead and “Allow” it.

The next few slides show the installation of JDK Version 8 Update 11 for a 32-bit Windows platform.

The process is similar for all JDK versions and platforms.

Load your web browser.The message below may appear.If so, select Enable to allow Java

programs to execute in your browser.

Double Click the appropriate jGRASPfor your platform.

For Windows

For Mac

As before, Windows will be asked for permission to install. “Allow” it again.

The next few slides show the installation of jGRASP Version 2 Update 15 for a Windows platform.

As with the JDK, the process is similar for all jGRASP versions and platforms.

Double Click the jGRASP icon.

This window only shows up the first time.To avoid potential headaches

Don’t Allow this feature.

If jGRASP informs you that a new updateis available, go ahead and accept it.

This is the jGRASP IDE with no files loaded.

Click Settings.Scroll to

Compiler Settingsand select

Workspace.

Select the Compiler tab followed by the HTML tab.

Highlight the code in this window and press

<Control>-<C>.

Click here to remove the small square.

By doing this, we are indicating that we do NOT want the default

width and height.

After you click the square the default code will vanish.

Click in the empty white space and

press <Control>-<V> to paste or

velcro the text you copied earlier.

Now change the width to 1000 and the height to 650.

NOTE: If you were not able to copy and paste the text, then you need to manually type the

code above EXACTLY as it appears in the white box.

Select the Font tab.

Do NOT alter these Default values!

If you have difficulty reading small textyou may alter these values:

First, de-select these default boxes.

With the boxes de-selected, you can make the text bigger. Do NOT make it smaller than 10.

When done, click Apply followed by OK.

Click the Open File icon.

Browse to Programs02 or Programs02B.

Browse to Programs02 or Programs02B.

Browse to Programs02 or Programs02B.

Browse to Programs02 or Programs02B.

Open Java0201.java

Now Java0201.java is loaded in the Edit Window.

Click this icon to see all of the files in the same folder as the loaded file.

NOTE: Files can be loaded directly from this window.

Click this icon to show the line numbers.Visible line numbers are very useful

when your program has errors.

Click the green Plus Sign ( + )to compile the program.

The message below indicates that the compiler is finished compiling.

The fact that there are no errors and the Java0201.class bytecode file has been created indicates the compiling was successful.

NOTE: You will not see the .class file in the File Window unless this is set to All Files.

Click the red Running Man icon to “run” or execute the program.

For some programs, you may have to drag the border between the top and bottom windows up to see the entire output.

NOTE: Now that both the JDK and jGRASP are installed, and we have an understanding of how to function in jGRASP, we now wish to focus on the actual Java programs. A GUI display like this might look nice, but only a small part of the screen is devoted to the program. GUI displays also take up considerable memory and are not at all practical for a textbook with hundreds of examples. A different format will be used to view all remaining programs in both the textbook and the PowerPoint slides.

Recommended