Installing Java
In this part of the jee tutorial series, we will install the Java Development Kit (JDK). The JDK is a software development kit used to create Java applications. If we need to run Java applications, we only need the Java Runtime Environment (JRE). If we want to create Java applications, we also need the JDK. The JDK also includes JRE. Primary components of the Java Development Kit are Java compiler, laucher, documentation generator, debugger, dissasebler, archiver.There are three basic Java editions.
- Java SE - Java Standard Edition
- Java EE - Java Enterprise Edition
- Java ME - Java Micro Edition
Steps
These are the steps to install the latest JDK on Linux. When I write these words it is JDK 6 Update 3.- go to http://java.sun.com/
- select menu downloads - Java SE
- click on the download button of the latest JDK version
- accept licence agreement
- download the the appropriate version of java, Linux self-extracting file, 65.40 MB
- sudo chmod +x jdk-6u3-linux-i586.bin
- ./jdk-6u3-linux-i586.bin
- Do you agree to the above license terms? [yes or no] yes
- mv jdk1.6.0_03/ installdir
$ export PATH=$PATH:/home/vronskij/bin/jdk1.6.0_03/bin/We add the bin directory to the PATH variable. On my computer the path to the java bin directory is /home/vronskij/bin/jdk1.6.0_03/bin/
$ java -versionWe verify the installed version of java. Now let's create a simple java console application. Launch your favourite text editor and write down the following code.
java version "1.6.0_03"
Java(TM) SE Runtime Environment (build 1.6.0_03-b05)
Java HotSpot(TM) Client VM (build 1.6.0_03-b05, mixed mode, sharing)
/* Console.java */This sample program will print text on the console window.
public class Console {
public static void main(String[] args) {
System.out.println("Java console application");
}
}
$ javac Console.javaWe compile the source code with the javac command. Then we lauch the program with the java command.
$ ls
Console.class Console.java Console.java~
$ java Console
Java console application
export JAVA_HOME=/home/vronskij/bin/jdk1.6.0_03/bin/We set up the JAVA_HOME variable to point to our JDK. This is for other applications like ant or Netbeans, so that they know, where the Java has been installed.
In this part of the JEE tutorial, we covered Java installation.
0 comments:
Post a Comment