In fact, Java's native platform is Linux, but it can run across platforms. There are even native JDK in Linux, but these JDK is not complete, so it is best to configure a jdk1,7, for the future of Tomcat, Android and other ready. The following is an example of how to configure the JDK in Linux with JDK1.7 in Debian configuration.
First, the download and installation of JDK1.7
1, first, as in Windows configuration JDK, open Java's official website (click Open Link) agreed to the agreement, download the Linux version of the JDK, download the compressed version of the. tar.gz. Remember to agree to the agreement, otherwise never let the download. I386 32-bit version of the download Linux x86,amd64 version of the download Linux x64, do not make the wrong, otherwise configured, can never run. The Windows configuration jdk can refer to the download, installation, and deployment of the Java JDK (click the Open link).
2, it is best to download this file to the Linux/tmp folder, so this folder Linux a reboot, the inside of the things will not.
3. After you open the root terminal, extract the files to the USR/LIB/JVM directory.
Enter a command to enter the TMP folder first
Cd/tmp
Re-enter the instructions to extract the files to the USR/LIB/JVM directory:
Tar zxvf./jdk-7-linux-i586.tar.gz -C/USR/LIB/JVM
Of course, you are in the graphical interface, you can, for example, first enter a tar zxvf, and then drag the jdk-7u75-linux-i586.gz into the-C/USR/LIB/JVM, so you can enter something less.
4, press ENTER after the long decompression process. Until the command line appears again, the file is compressed.
5, in the upper right corner of the attachment-and file into the file Manager, or using the cd instruction dir, you can see the decompression,/USR/LIB/JVM more than a jdk1.7.0_15, which proves that the compression is good.
Second, the configuration of JDK1.7
1. Enter the command at the root terminal:
Gedit ~/.BASHRC
The console appears with a bunch of warnings. This thing can't be opened with a graphical interface. Because the root permission is required to change the file, the following configuration is written at the bottom of the environment variable file:
Export Java_home=/usr/lib/jvm/jdk1.7.0_75export Jre_home=${java_home}/jreexport classpath=.:${java_home}/lib:${ Jre_home}/libexport Path=${java_home}/bin: $PATH
2, ctrl+s after saving exit, and then enter at root terminal:
SOURCE ~/.BASHRC
Make it effective.
3. Reboot our Debian Linux, or enter reboot directly to reboot.
4, restart and then open the root terminal, one line to enter the following instructions, when prompted to choose the default JDK, we selected in their own just installed JDK1.7, is generally the last item, here is the input 2 after the return.
Update-alternatives--install/usr/bin/java Java/usr/lib/jvm/jdk1.7.0_75/bin/java 300update-alternatives--install/ Usr/bin/javac Javac/usr/lib/jvm/jdk1.7.0_75/bin/javac 300update-alternatives--config java
5, then restart our Linux. These two parts, you do not restart, but also really have problems, the author's own test.
6, and then enter the Java version to appear jdk1.7 release information, prove that our jdk1.7 has been installed successfully.
Third, Java programming under Debian
After you've done the Debian JDK1.7, of course, write a Hello World, "Hello, Worid!" "Program to Shuangshuang.
1, we still go into the/tmp folder to create a new Hello.java, using the graphical interface, the upper-left corner of the application, file, and left "file system"->tmp, and then right-click on the creation of a new document, a blank document, Name it Hello.java, as follows:
Use terminal to enter the following command:
Cd/tmptouch Hello.java
2. Open the Hello.java with the Gedit editor from Debian, or use the command:
Gedit Hello.java
3, after the inside typed the following Java code, save exit, this is not the point. Today's protagonist is Linux:
public class hello{public static void Main (String args[]) { System.out.println ("Hello");}}
4. At this point, you need to change the permissions of the Hello.java attribute, give all read and write permissions, and then most crucially, allow the program to execute the file.
5, after, like the Windows command line is OK, in the root terminal into the TMP directory, enter:
Javac Hello.java
Of course, when the input Hello.java, do not want to lose the file name, you can also like that, drag Hello.java in:
6, if the compile time appears "insufficient permission", that is just did not give Hello.java an option to allow the program to run.
7, after, in the/tmp directory will be more than a hello.class, enter the following command:
Java Hello
You can run it.
"Linux" in Debian configuration JDK1.7, with Linux Java Helloworld