Menu

Java setup

Tutorials (3)
khayman8

Java is comprised of an SDK (called the JDK) and the virtual machine (or JVM) which is part of the Java Runtime Environment (JRE). Java is also scaled between the standard edition (SE), the enterprise edition (EE), the mobile edition (ME) and so on and so forth.

We need to download the EE version (we'd be just fine with the SE version, just a matter of preference) of the JDK and the JRE for Java 7, plus the demos and samples (which help a lot when you need to get a glimpse of how something is done). The API documentation is available online but I suggest downloading a local copy.

We also need to append the path to our Java runtime tools to the system path.

So, here we go.

1. The JDK and JRE

Go to http://www.oracle.com/technetwork/java/javase/downloads/index.html and download the Java SE 7u3 JDK. Don't mind the SE part, it is irrelevant. The JRE is included in the JDK.

2. The demos and samples

Go to http://www.oracle.com/technetwork/java/javase/downloads/index.html and download the demos and samples. Make a mental note for where you place those files, better yet, make a shortcut on your desktop.

3. The API documenation

Go to http://www.oracle.com/technetwork/java/javase/downloads/index.html, scroll down and download the Java SE 7 Documenation. Make a mental note for where you place those files, better yet, make a shortcut on your desktop.

4. Appending the system path

Right click on My Computer (or whatever), go to additional system settings, environment variables, find and edit the PATH system variable. The separator is the ';' character, add your Java path at the end of the existing string. You need to append the 'bin' subdirectory of your Java directory, so it would look something like 'C:\Program Files (x86)\Java\jdk1.7.0\bin', but verify for your installation.

5. Testing 1-2-3

Paste the following on notepad and save it as Hello.java (yes, Hello.java, not hello.java or helloWorld.java or whatever.java, just Hello.java) on your Desktop directory (ON YOUR DESKTOP DIRECTORY!).

:::java
public class Hello {
    public static void main(String args[]) {
        System.out.println("Hello World!");
    }
}

Now, open a command prompt and type

# cd Desktop
# javac Hello.java
# java Hello

If it greets the world, you're done.

Christos.


Related

Wiki: Home

MongoDB Logo MongoDB