Difference between revisions of "Installing JDK and DrJava"

From CompSciWiki
Jump to: navigation, search
(Remove TextPad material.)
 
(67 intermediate revisions by 10 users not shown)
Line 1: Line 1:
{{1010Topic|Chapter_TOC=[[User-Defined_Methods]]|Introduction=To start programming in Java, you will need to install the Java Development Kit (JDK) and Textpad. This section describes how to do this, and gives a brief overview of the Textpad development environment.|Overview=This topic will describe how to install JDK and Textpad, and will show you several features of Textpad.}}
+
{{Template:1010Topic
 +
|Chapter_TOC=[[Getting Started]]
 +
|Previous=[[Setting up your own computer]]
 +
|Next=[[Setting up your own computer]]
 +
|Body=
  
=How to Install=
+
==Introduction==
To create and run Java programs on your home computer, you will need to download the Java Development Kit (JDK) and Textpad. JDK allows your computer to create and run Java programs, and Textpad is used for writing and running your programs.  
+
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.
  
'''IMPORTANT:''' Install the JDK first! If you install it after you have already installed Textpad, you will need to manually set up Textpad to compile and run Java programs.
+
==Installing the JDK==
  
Below are links with the downloads and installation instructions.
+
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.
  
* JDK
+
===Windows===
** Download and installation: http://java.sun.com/javase/downloads/index.jsp
+
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.)
* Textpad
+
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.
** Download: http://www.textpad.com/download/index.html#downloads
+
** Installation: http://www.textpad.com/download/index.html#instructions
+
  
=Helpful Textpad Options=
+
* JDK Download and installation: http://java.sun.com/javase/downloads/index.jsp
==Introduction==
+
 
Textpad is a very basic text editor for Windows. It is much like Notepad but with a few more bells and whistles.
+
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.)
  
==Main Environment==
+
* DrJava Download and Installation: http://drjava.org/
===Menu Bar===
+
The menu bar is located at the top of the window. It contains the following menu items: File, Edit, Search, View, Tools, Macros, Configure, Window and Help. To see a description of each menu item, move your mouse over the item name and look at the bottom-left of the Textpad window for a description. Try fiddling around with them and get a good understanding of what they all do.
+
  
===Toolbar===
+
===Mac===
The toolbar is located directly under the menu bar and contains buttons for commonly used tools. To customize which buttons appear:
+
# Right click on the tool bar
+
# Select Customize
+
# Click on the "Commands" tab
+
# Select the category desired
+
# Click and drag the icon to the desired location on the toolbar
+
  
===Document Chooser===
+
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:
The document chooser displays all of the files that are currently open. To change which file you are looking at in the editing area simply click on the file's name. To close a file, right click on the file name and select "Close document(s)".
+
  
===Clip Library===
+
* Apple version 6 of the JDK: http://support.apple.com/kb/DL1421.  
The clip library (located under the document chooser) is used as an easy way to insert strings of text into the document. Simply double click on the string of text desired and it will be inserted wherever the text cursor is located. To change the current clip library that is being displayed, pick the one you want from the dropdown menu which is located at the top of the clip library window. You can download and add more clip library at: http://www.textpad.com/add-ons/cliplibs.html
+
  
===Editing Area===
+
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.  
The editing area is where all the text is entered. To view line numbers, click on the "View" menu item and select "Line numbers".
+
  
==Additional Helpful tips==
+
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.
===Changing the Font for Java Documents===
+
# Select the menu-item "Configure, and then select "Preferences".
+
# Click on the plus sign (+) beside "Document Classes".
+
# Click on the plus sign (+) beside "Java".
+
  
Now you can change how Textpad displays files that end with .java
+
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.  
  
===Handy Keyboard Shortcuts===
+
* DrJava Download and Installation: http://drjava.org/
Textpad has many helpful keyboard shortcuts. Here is a brief list of the most helpful commands:
+
; Ctrl+M: Find the matching {} or ().
+
; F5: Search
+
; Ctrl+F2: Set/delete a bookmark on the current line (makes it easier to find later).
+
; F2: Go to next bookmark.
+
; Ctrl+1: Compile Java program.
+
; Ctrl+2: Run Java Program (You must compile before running).
+
  
===Where to Find More Keyboard Shortcuts===
+
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.)  
# Select Help Topics from the Help menu.  
+
# Click on the plus sign (+) that appears beside Referencing Information
+
# Select "The Keyboard"
+
  
This will list all of the keyboard shortcuts.
+
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.
  
=Common Problems=
+
==Alternate Windows Development Environment: TextPad==
  
==Textpad Does Not Have the Options to Compile and Run==
+
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]].
First, make sure that you have installed the JDK. Then uninstall Textpad, and install it again.
+
To uninstall Textpad:
+
# Click on the Start button at the bottom left corner of the screen.
+
# Click Control Panel
+
# Double click on Add or Remove Programs
+
# Scroll down the list until you find Textpad
+
# Click on the Change/Remove button
+
# Follow the prompts to uninstall Textpad
+
  
==I Get A Popup When I Try To Save==
 
If you get a popup that asks if you would like to register or continue evaluation, simply click on "Continue Evaluation". The trial period of Textpad will never run out.
 
  
==Sample Code Does Not Compile==
+
}}
If your instructor has given you a code example which does not compile on your machine, you may have a different version of the JDK than they do. Please contact your instructor for instructions on getting the code to compile.
+

Latest revision as of 12:10, 21 August 2014

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