Learning Java 1th
1. What is JDK?
JDK is short for Java Development Kit. It includes Java runtime environment, Java tools, Java foundation class libaray(src.tar) etc.Until today, the lastest version is seven.
2. Download and install the JDK
My computer is X64 architecture, and the operation system is WIN8, So I pick up the JDK of windows x64.The download link is :http://www.oracle.com/technetwork/java/javase/downloads/index.html. When you finish download, double click the install package, and follow the instructions steps to steps.
3. Set up your environment variable
Right click shotcut named my computer, and choose attritube, then it will open a new window, click the high system setting, and click the environment vaiable button, finally it will open a new window, so you can set up JDK environment variables now.
Add a new system variable named 'JAVA_HOME',and valued the JDK installation location. This is the first environment variable.
Check the variable name 'path' exists or not, if not exists, add new, else edit the old variable value.(Attention:Do not delete the original variable's value, just add string '%JAVA_HOME%\bin' to the end, don't forget to make signal ';' first. Because it could help to recongine the independent string.) This is the second variable.
Check the variable name 'CLASSPATH' exists or not, if not exists, add new, else edit the old variable value. The same attention to the seond variable, just add string ';%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar'. This is the last variable.
PS. A introduction to dt.jar and tools.jar. This two are the foundation package of JAVA.
4. Test your JDK
Press win+r and input 'cmd' to open DOS.Then input 'javac' and press Enter, the help information of 'javac' will occur. If not, it means that there is something wrong with your operation, please back to step 3 to check out this problem.
5. Write a java class and compile
To create a new txt file, and write down the words as follows:
public class Test
{
public static void main(String[] args)
{
System.out.println("Hello java!");
}
}
Next step is to name the file name as 'Test.java'. I also put the file to directory 'E:/Temp/'. Then open the DOS, input 'E:' and press Enter, input 'cd Temp' and press Enter, now you are in E:/Temp/.
Now you can begin to compile it. Input 'javac Test.java' and press Enter.Back into the directory 'E:/Temp/' , now you will see it has a new file named 'Test.class'.
To input 'java Test' and press Enter, if you see the string 'Hello java!', congratulations!You have succefully done it!
6. Choose your Java IDE
IDE is short for Intergrated Development Envirorment. There are servel choices for Java development, including free software and charging software. Here I want to recommend a IDE called Eclipse, what is free and open-source.It is small with flexible design.It is not only support Java, but other development language like c++, php etc.The important thing you have to do is to install piugin. You can download the Eclipse form here:http://www.eclipse.org/downloads/. After download the Escilpe, just uncompress it to a directory, then you can use it to make your first Java program.

浙公网安备 33010602011771号