Recently intends to learn the Java language.
For beginners like me, in the beginning, I want to experience, roughly see what the Java language is, how to achieve ...
And the egg o_o, said to see very confused. Or practice is the most important, the environment is well-configured to start deep learning.
1. First, to the official website:
http://www.oracle.com/technetwork/java/javasebusiness/downloads/java-archive-downloads-javase6-419409.html Download JDK
I downloaded the 64-bit jdk-6u13-linux-i586.bin.
2. To install the JDK, open the terminal:
(1) To use root permissions, the first is to change the executable permissions of jdk-6u13-linux-i586
Using the LL command, you can see:
jdk-6u13-linux-i586 executable permissions changed to: (about the user rights, I am direct Baidu, the information is very much)
(2) Next, execute jdk-6u13-linux-i586
Will generate: jdk1.6.0_45
(3) Then, move the generated jdk1.6.0_45 to the/OPT directory
3. Configuring Environment variables
To add an environment variable by opening/etc/profile with Vi/vim
Add: (Java_home for jdk1.6.0_45 's installation directory)
P.S: After the environment variable was added, there was a strange problem in later use, and now I am not very clear about the situation (also look at the road Master pointing Maze).
Questions: My Java_home path was added successfully, and then I can't find it when I use some class files, that is, I can't find the file I added on classpath.
So I used the echo $CLASSPATH want to see the classpath I added on the class file, really did not, I thought I wrote the wrong, seriously modified several times/etc/profile, or does not work.
Resolution: Later changed the method of adding CLASSPATH, I directly in the terminal input export classpath= $CLASSPATH: $/opt/jdk1.6.0_45/lib/dt.jar, this time only successfully added.
4. Test the installation situation
in Terminal input: look at the version number, indicates that the installation was successful.
Next, write a short piece of code to test it. In its own directory, the terminal input vim Hello.java, edit
Input instructions:
To compile the Hello.java, Javac is the JDK compiler that compiles hello.java into bytecode, which is the resulting Hello.class file
Javac Hello.java
Executes the compiled bytes in the Interpreter
Java Hello
The result is the most common Hello world! output ~
End of Environment Configuration ~
Environment configuration for Java under Linux