How to use Notepad to write Java programs simply

Source: Internet
Author: User

1. Create a new Notepad with a. java suffix and write a Java code in it
2. Throw the written Java file into the D drive, which is the class file given in the first step;

3. Open the DOS interface to start-〉 run-〉cmd-〉 This is the command line mode, select D drive
4. After selecting D, enter "Javac file name. java" in the command prompt, and my file name is Java, so enter Javac Java.java and then return, wait for compilation. At this point you will find that it hints that javac is not an internal file. The next step is the Java environment variable setting problem;

5. Download a JDK to perform the default installation. For example, my next JDK version is: Jdk-6u10-rc2-bin-b32-windows-i586-p-12_sep_2008.exe;

6. Configure the Environment: Right click on My computer point properties, go to the point of advanced to see the environment variables. You can set your system variables by entering it.

6-1. Variable name: Classpath Variable Value: (.; C:\Program files\java\jdk1.6.0_10\lib;) parentheses inside (mainly when we compile and run the program through Classpath can help us find some of the required system classes, "." Number is the current path; ";" Number is used to separate multiple variable values, if your system has CLASSPATH environment variables, you do not have to create a new, directly add ";" Number, add a new value later)
6-2. Variable Name: PATH variable value: (C:\Program files\java\jdk1.6.0_10\bin;) parentheses inside (usually the system already has the PATH environment variable, so simply add the path to the path variable; because Windows For external commands, the executable is searched by the path specified by the PATH environment variable, so in order to execute commands such as Java and Javac, the path of Java and Javac should be added to path. )

7. After the bad environment is set up, you can go back to our fourth step, enter "Javac file name. java" in the command prompt, my file name is Java, so enter Javac Java.java and return, wait for compilation.

8. Then we can view our D-disk with a java.class file;

9. Next enter the Java file name on the command line (for example, my Java, the naming may be a little bit problematic), our program can run.

How to use Notepad to write Java programs simply

Related Article

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.