How to get started developing in Java

 

You can type your source code into any text editor such as Windows’ Notepad, or Helios’  Texpad.  You can even theoretically type your code into a word processor such as Microsoft Word as long as you save the file as ‘text’ (though I strongly recommend against it for reasons I won’t get into here).  Yet in order to convert your Java source code into a program that your computer can understand, you need a Java compiler.  Obtaining a Java compiler is easy and free (although the installation can sometimes be a bit of a pain).  You will need to download the Java Standard Developer’s Kit (JDK) from Sun.  The SDK contains a Java compiler plus all of the libraries of code that are now part of the Java standard.  We will discuss libraries in lecture. 

 

What is the SDK?

The SDK is a package that includes (among other things) the Java compiler, JVM (Java Virtual Machine), an applet viewer, a debugging tool, and the standard Java class libraries.  If you do not wish to develop Java programs, but only to run them, you do not need the SDK since you probably already have a copy of the JVM running on your machine.  (For example, the JVM is installed along with all the major browsers and some operating systems). 

 

Where can I get the SDK, and which version should I use?

There is a fair amount of confusion out there over what tools exactly are needed to develop in Java.  For our purposes, you only need the SDK.  To get it, you can go directly to http://java.sun.com/j2se .  (To save yourself from a long download, the SDK is also on the CD that came with your textbook). The version you should download is v.1.6 or later.

What is the difference between the SDK and JDK?

You may notice or come across the acronym ‘JDK’.  JDK stands for ‘Java Development Kit’ and is simply the older name for what we nowcall the SDK.  However, when you install the SDK, you will notice that it will name the directory in which you install the kit something like:  C:\JDK1.1.6 .  That is, note that the directory name has the acronym ‘jdk’ in it instead of ‘sdk’.  There is no useful reason for this (that I know of), other than to add a little extra confusion to our lives.  The long and short of it:  if you refer to JDK or SDK, you are essentially referring to the same thing. 

Which development environment should I use?

A development environment typically includes a compiler and souped-up text editor to make your coding tasks easier.  There are a number of different programming environments available for you to use in developing your Java programs.  The one I have decided to use for CSC-211 is TextPad (http://www.textpad.com/). 

 

What is TextPad?

TextPad is a simple but powerful text editor.  It has lots of useful functionality and can be used to write code in anything from Java to C++ to HTML.  To code in Java, it is best to first install the Java SDK (standard development kit), and then install TextPad.  I will discuss this further during the first lecture. 

 

One More Suggestion

For this course, your life will be much easier if you put the following things in the same directory.  So for example, create a directory on your computer called ‘Java’ or ‘211’ or something similar.  Then store all of the following inside: