Java file Compilation and operation

Source: Internet
Author: User

1 Configuring Environment variables

Use the mouse to right-click My Computer, properties, advanced environment variables

new variable name, System variable: Java_home variable Value: C:\Program Files (x86) \java\jdk1.8.0_11Variable name: CLASSPATH variable, system variable, value:.; %javA_home%\lib (Be careful not to omit the current path.;)variable name, editor, System variable: Path is preceded by the value of the variable:%java_home%\bin;2 compiling Java filesJavac Helloworld.java3 Execute class fileJava HelloWorld4. bat file Generationin the document, enter:Javac Helloworld.javaJava HelloWorld@pause
Save As execute file. bat. the role of environment variable configuration:1. Path environment variable. The function is to specify the command search path, execute commands under the I command line as Javac compiles the Java program, it looks in the path specified by the path variable to see if the appropriate command program can be found. We need to add the bin directory in the JDK installation directory to the existing path variable, and the bin directory contains the frequently used executables such as Javac/java/javadoc wait, and after setting the path variable, you can execute the Javac/java tool in any directory. 2. Classpath environment variables. The role is to specify the class search path, to use the already written classes, the premise is to be able to find them, the JVM is through the classpth to find the class. We need to set the Dt.jar and Tools.jar in the Lib subdirectory of the JDK installation directory to classpath, of course, the current directory "." must also be added to the variable. 3. Java_home environment variables. It points to the JDK's installation directory, and software such as Eclipse/netbeans/tomcat finds and uses the installed JDK by searching for java_home variables.

Java file Compilation and operation

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.