Write HelloWorld in Java with Notepad

Source: Internet
Author: User






First, install and configure the JDK (image from Baidu Experience)




Install JDK two installation prompts appear during installation of the installation directory. The first time is to install the JDK, and the second is to install the JRE. It is recommended that all two are installed in a different folder in the same Java folder. (cannot be installed in the Java folder root directory, JDK and JRE installed in the same folder will be error)


As shown


1: Install JDK optional directory simply change the directory before the default installation directory \java


2: Install jre→ change →\java before directory and install JDK directory


Note: If no installation directory is required, all default settings are available. No need to make any changes, two times directly point to the next step.


Configure environment variables after installing JDK computer → properties → advanced system settings → advanced → environment variables


System variables → new java_home variable.


Variable value fill in the JDK installation directory (I am E:\Java\jdk1.7.0)


System variables → find Path variable → edit


Enter%java_home%\bin;%java_home%\jre\bin at the end of the variable value;


(Note that the original path of the variable value at the end of there is no; number, if not, first enter; number and then enter the above code)


system variable → new CLASSPATH variable


Variable value fill  .; %java_home%\lib;%java_home%\lib\tools.jar (note the first point)


System variable configuration complete


7

Verify that the configuration is running successfully cmd input java-version (there are spaces between Java and-version)


If the version information is displayed, the installation and configuration are successful.


Second, create a new Helloworld.java file and run 1. On the "desktop" (the file location arbitrarily built, I on the desktop) on the new Helloworld.java file, the class name in the file must be the same as the file name, such as Public class helloworld{

public static void Main (string[] args)

{

System.out.println ("Hello world!");

}

} Save (ctrl+s remember)2. Start-Run (Window key +r)--"input cmd Note: If the Main method cannot be found or cannot be loaded, it is likely that the environment variable is not configured correctly



Write HelloWorld in Java with Notepad




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.