Installing JDK and DrJava

From CompSciWiki
Jump to: navigation, search

COMP 1010 Home > Getting Started


Introduction

To start programming in Java, you will need to install the Java Development Kit (JDK) first.You will also need to install a development environment where you can write and run your Java programs. The development environment you need to install depends on the operating system your computer runs on. This section is subdivided to guide you through installing the right software for your computer.

Installing the JDK

Below are the instructions for setting up the JDK for various operating systems you may be using. Consult your professor if you cannot get the JDK working.

Windows

Click on the link below, and then click on the large button at the top indicating Java Download (not NetBeans). When the Java website shows you a selection of operating system versions, choose 'Windows x86'. Do NOT choose 'Windows x64'. (This version will work on most new Windows computers, but it does not interact well with QuickTime and with TextPad. We recommend the Windows x86 version to avoid dealing with problems that might arise.) Install the Java Developer's Kit (JDK). The JDK allows your computer to create and run Java programs. It also includes the Java Runtime Environment (JRE) which can be used in browsers.

After you have installed the JDK, go to the site below and download the Windows version of DrJava. For a guide on using DrJava, simply click on the "Documentation" or "QuickStart Guide" link on the lefthand side pane on http://drjava.org/. Note that the file you download is an exe file that can be installed anywhere (e.g., your Desktop or the folder where you keep your COMP 1010 java files.)

Mac

The newest version of Java in 2014 is Java 8. Mac computers used to come with Java installed, but it was Apple's own version, obtained from Apple, not from Oracle. Apple stopped developing Java versions at Java 6. If you install the DrJava application below, it will demand Apple's version 6 of Java, which can be downloaded from this site:

Apple's version is fine for developing code in this course, but it explicitly prevents your browser from running Java apps. There have been a lot of bugs found in the Java Runtime Environment (JRE), which is included in the JDK. Any older version of the JRE (such as Apple's) is not safe to use in a browser. Instead of trying to fix the bugs, Apple just prevented browser use.

However, if you go through the same procedure as Windows users above, you can download and install version 8 of the JDK for Mac OS X from Oracle in the same way as you download a Windows version. You cannot easily use this version with DrJava, but it can co-exist with the Apple version of Java, and it can support Java applications in your browser.

After you have installed Apple's version of the JDK, go to the site below and download the Mac version of DrJava. For a guide on using DrJava, simply click on the "Documentation" or "QuickStart Guide" link on the lefthand side pane on http://drjava.org/, though there is not much information about the Mac version specifically.

Note that the file you download is a tar.gz file. That means it is a compressed file. If you double-click on this file, built-in utilities on your Mac should produce a DrJava.app file in the same folder. This file can then be moved anywhere (e.g., your Desktop, or Applications, or the folder where you keep your COMP 1010 java files.)

To use DrJava on a recent Mac, you may need to adjust your Security Settings. If you don't, you may get an error "DrJava is damaged and can't be opened. You should move it to the Trash." This message is incorrect and misleading. It really means that your security settings prevent the operating system from opening a file that doesn't come from a developer on an internal developers list. Open your Settings and click on "Security & Privacy". If the lock at the bottom of the window is closed, click on it and provide your password to allow changes. Then change the setting to "Allow apps downloaded from: ... Anywhere". (Once you have used DrJava once, you can change this setting back to its original value if you want.) Right-click on DrJava.app and choose Open. Now you will likely get a message about it being from an unrecognized developer. Click on the Open button provided, and it should work. This rigmarole will only be required once.

Alternate Windows Development Environment: TextPad

Some students may wish to program using TextPad (instead of Dr. Java). The following instructions are for students using TextPad with the JDK. There is no penalty for choosing to use TextPad instead of DrJava. See Installing and Using TextPad.

Previous Page: Setting up your own computer Next Page: Setting up your own computer