Java EE Installing Java

Материал из Wiki.crossplatform.ru

(Различия между версиями)
Перейти к: навигация, поиск
(Новая: In this part of the jee tutorial series, we will install the <b>Java Development Kit</b> (JDK). The JDK is a software development kit used to create Java applications. If we need to run...)
(нарушало авторские права)
 
Строка 1: Строка 1:
-
In this part of the jee tutorial series,  we will install the <b>Java Development Kit</b> (JDK). The JDK is a software development kit used to create Java applications. If we need to run java applications, we only need the <b>Java Runtime Environment</b> (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
 
-
 
-
If we download the JDK we can create Java SE applications. These are basically command line applications a Java Swing GUI applications. Java EE is used to create enterprise applications. The Java ME is used to create mobile applications. For both of them, we need to install additional libraries. Java EE is the target of our tutorials.
 
-
 
-
== 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
 
-
 
-
<source lang="java">
 
-
$ export PATH=$PATH:/home/vronskij/bin/jdk1.6.0_03/bin/
 
-
</source>
 
-
 
-
We add the bin directory to the <b>PATH</b> variable. On my computer the path to the java bin directory is /home/vronskij/bin/jdk1.6.0_03/bin/
 
-
 
-
<source lang="java">
 
-
$ java -version
 
-
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)
 
-
</source>
 
-
 
-
We 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.
 
-
 
-
<source lang="java">
 
-
/* Console.java */
 
-
 
-
public class Console {
 
-
 
-
    public static void main(String[] args) {
 
-
        System.out.println("Java console application");
 
-
    }
 
-
 
-
}
 
-
</source>
 
-
 
-
This sample program will print text on the console window.
 
-
 
-
<source lang="java">
 
-
$ javac Console.java
 
-
$ ls
 
-
Console.class  Console.java  Console.java~
 
-
$ java Console
 
-
Java console application
 
-
</source>
 
-
 
-
We compile the source code with the javac command. Then we lauch the program with the java command.
 
-
 
-
<source lang="java">
 
-
export JAVA_HOME=/home/vronskij/bin/jdk1.6.0_03/bin/
 
-
</source>
 
-
 
-
We set up the <b>JAVA_HOME</b> 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.
 
-
 
-
[[Категория:Java]]
 

Текущая версия на 11:36, 7 апреля 2009