Your Computer Science Resource

HOW-TO: Set Up Your Java Environment

So you’re ready to start learning Java, but you don’t know where to begin. The first thing you need to do is download, install, and set up your Java environment. Because there are different development kits for Java, it can sometimes be confusing for a new user to understand which one they need to download.

Which Development Kit?

Listed below are Java’s three different development kits:

  1. Java ME (Micro Edition) - used primarily for developing applications on mobile devices (phones, PDAs, etc.).
  2. Java SE (Standard Edition) – used for developing desktop & server applications.
  3. Java EE (Enterprise Edition) – used for developing enterprise-level applications

All of these kits share the same “core” but also differ in various ways. For example, Java ME is the same as Java SE with certain classes stripped away (in order to preserve space); Java EE is built on Java SE with added classes. This article will focus on setting up Java SE.

Downloading & Installation

At the time of this article, the latest version is Java SE Development Kit 6 Update 5. On that page, select the most recent version and click “Download.” In order to download, you must first accept their license agreement. Once that is done, choose your platform (Windows, Linux, Solaris, etc.) and begin downloading. For specific platform installation instructions, follow the instructions for your operating system.

Finding & Setting Your Path

Finding Your Path

Setting your path is critical to the operation of Java. The path ultimately defines where Java resides on your file system, and without setting it, your programs simply will not be able to run [outside of the /bin/ directory]. But how do you know what your path is? If you’re on Windows, it will usually be:

C:Program FilesJavajdk1.6.0_03bin

(where 1.6.0_03 can be different, depending on your version of Java). Also be sure that you take note of the directory that begins with JDK as opposed to JRE (this is not the correct path!).

Now that you know what your path is, you have to set it.

Setting Your Path (Windows)

  1. Right-click on My Computer
  2. Click Properties
  3. Click on the Advanced tab
  4. Click the Environment Variables button
  5. Look under System Variables
    1. In the list of variables, select PATH if it isn’t already highlighted.
    2. Click the Edit button.
    3. Terminate the previous variable with a semi-colon and append your Java path to this list (from the above steps).
  6. You may also add or edit this same variable in the User Variables list.
  7. Once you’re done, click OK.
  8. You may or may not have to restart your computer after making the above changes.

Conclusion

Now that you’ve installed and set up Java, you can begin programming — but what program should you use to develop? There’s tons out there, but you can use something as simple as Notepad to something as complicated as an IDE (Integrated Development Environment). A couple of my favorites are jGrasp (lightweight application) and Eclipse (full-fledged IDE).

Questions, comments, or additions? Please leave them in the comments!

Tags: ,

Leave a Reply