Java preparation process

Source: Internet
Author: User

When I first started learning Java, I didn't know what software to use. I was confused and found some software on the Internet, but I still couldn't run it after installation. After the installation is difficult, you can record the installation process, which is also a small achievement in learning the beginning of Java.
1. My myeclipse is myeclipse_6.0.1ga_e3.3.20.fullstackinstaller.exe. Follow the instructions to complete the installation.

Note: The default installation is used during the push process for future convenience. I have also tried to change the path, but it is proved that the default installation will save a lot of trouble later.

2, install JDK, I installed version is: jdk1.6, executable file: jdk-6u7-windows-i586-p.exe. The default installation path is also used.

3. to run JavaProgramThe key step is to configure environment variables. The following is the configuration of environment variables.

Right-click my computer, select "properties", and select the "advanced" tab to go to environment variable settings. In the "System variables" column, set the following three environment variables:

(1) set the PATH variable so that we can run Java applications anywhere in the system. Find the PATH variable in the system variable and select-> EDIT:

Variable name: Path

Variable value: C: \ Program Files \ Java \ jdk1.6.0 _ 07 \ bin

(2) classpath environment variable. The role is to let the Java interpreter know where to find the class when we need to reference the classes written by others when developing Java programs. Sun provides some additional class packages, DT. jar and tools. jar. We need to add these two jar packages to our classpath environment variable. Because the original environment variable does not contain the classpath variable, you need to create a new classpath variable name.

Variable name: classpath

Variable value: C: \ Program Files \ Java \ jdk1.6.0 _ 07 \ Lib \ tools. jar; C: \ Program Files \ Java \ jdk1.6.0 _ 07 \ Lib \ DT. jar;

(3) set java_home.

First, for reference convenience. For example, if JDK is installed in the C: \ jdk1.6.0 directory, set java_home to the directory path. When this path is used in the future, you only need to enter % java_home % to avoid entering a long path string for each reference;

The second is the normalization principle. When the JDK path is changed, you only need to change the variable value of java_home. Otherwise, you need to change any document that uses the absolute path to reference the JDK directory, if the JDK cannot be found for a program in case of incomplete modification, the result can be imagined-system crash!

Third, the third-party software will reference the agreed java_home variable. Otherwise, you cannot use the software normally.

In the system environment variable column, click-> Create java_home (java_home points to the JDK installation path)

Variable name: java_home

Variable value: C: \ Program Files \ Java \ jdk1.6.0 _ 07

4. test whether the environment variable is configured successfully:

Public class helloworld {
Public static void main (string [] ARGs ){
Ystem. Out. println ("Hello world! ");
}
}

ReplaceCodePut it in notepad. Note: The notepad name should be the same as the class name.

5. "Start"-> "run", enter "cmd", and enter the path of the "helloworld" Class (I put it under drive D ). Method:

Enter D: Press enter. In the input cd d: \ (that is, the directory where the helloworld class is located), press Enter.

Input: javac helloworld. Java press enter and enter Java helloworld

At this time, if helloworld is printed, the installation is successful. If this sentence is not printed, check whether the above configuration is correct.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.