Getting Started with Java Foundation--java

Source: Internet
Author: User

Iscoder Tags: Java foundation, Java environment Configuration one. Java Environment configuration
    • Java Develop Kit (JDK installation)
    • System environment variable settings (java_home)
    • Java source program editing tools
    • Java compilation Run command
    • Run the classic HelloWorld program
1.1 JDK Installation

The JDK, the Java SDK provided to us by Oracle, includes the most common Javac.exe compilation tools and Java.exe run tools. It should be noted that the JDK already contains the Jer (Java Runtime Environment, Java Runtime Environment), so installing the JDK is a good place to develop Java applications.

JDK/JRE/JVM contains the diagram, as shown in:

The installation process is slightly ...

Latest JDK Download point for Oracle official website:http://www.Oracle.com

1.2 System environment Variable configuration

In the Java beginner stage, it is recommended to use the command line to compile and run Java programs, or to use EditPlus's tool group for configuration, provided that we have configured the environment variable (that is, path or java_home), regardless of how it is used, Need to place the path of the Java development tool into the path of the system run Program or command, this article recommends using the Java_home configuration, as this avoids mistakenly deleting the relevant values in the path that the system comes from.

Specific process, refer to the "Baidu Experience: Java System Environment Configuration detailedprocess."

1.3 Java source Program Editing Tool

Java source Program Editing the simplest tool is the Windows comes with Notepad tool, but because there is no syntax highlighting features, poor reading, it is recommended to use such as: EditPlus, UE, notepad++ ...

1.4 Java compile and run commands

①javac-------Java compilation commands, using:

Usage: Javac <options> <source files>
Among the possible options are:
-G generates all debug information
-g:none does not generate any debug information
-g:{lines,vars,source} only generates some debugging information
-nowarn does not generate any warnings
-verbose output messages about the actions that the compiler is performing
-deprecation output using outdated API source location
-classpath < paths > specifying where to find user class files and comment handlers
-CP < paths > specifying where to find user class files and comment handlers
-sourcepath < paths > Specify where to find the input source files
-bootclasspath < path > Overwrite the location of the boot class file
-extdirs < directories > overriding locations for installed extensions
-endorseddirs < directory > location of standard paths for overwriting signatures
-proc:{none,only} controls whether annotation processing and/or compilation is performed.
-processor <class1>[,<class2>,<class3>] The name of the comment handler to run; Bypassing the default search process
-processorpath < paths > specifying where to find comment handlers
-D < directories > specify where to place the generated class files
-S < directory > specify where to place the generated source files
-implicit:{none,class} Specifies whether to generate a class file for an implicit reference file
-encoding < encoding > specifying the character encoding used by the source file
-source < release > provides source compatibility with a specified release
-target < release > Generate a class file for a specific VM version
-version Version Information
Summary of-HELP output standard options
-a keyword [= value] The option to pass to the comment handler
-X output a feed of non-standard options
-j< tag > Direct < tag > pass to the runtime system
-werror terminating compilation When a warning occurs
@< file name > read from File option and file name

②java-------Java Run command, using:

Usage: Java [-options] class [args ...] (execution Class) or Java [-options]-jar jarfile [args ...] (Execute JAR file)
Among the options are:
-d32 using a 32-bit data model (if available)
-d64 using a 64-bit data model (if available)
-client Selecting the "Client" VM
-server selecting the "Server" VM
-hotspot is a synonym for the "client" VM [obsolete] The default VM is the client.

Class search paths for-CP < directories and Zip/jar files >
-classpath < directory and Zip/jar file class search path > use; A delimited list of directories, JAR files, and zip archives used to search for class files.
-d< name >=< value > Set System Properties
-VERBOSE:[CLASS|GC|JNI] enable verbose output
-version output product version and exit
-version:< value > requires the specified version to run
-showversion output product version and continue
-jre-restrict-search | -no-jre-restrict-search include/exclude user-specific JRE in version search
-? -help Output This Help message
-X output Help for non-standard options
-agentpath:<pathname>[=<.] Load the native agent library by full path name
-javaagent:<jarpath>[=<.] Loading the Java programming language agent See Java.lang.instrument
-splash:<imagepath> Display the splash screen with the specified image
For more information, see http://www.oracle.com/technetwork/java/javase/documentation/index.html.

1.5 Running the first Java program
public class HelloWorld {public static void main (string[] args) {System.out.println ("HelloWorld.");}}

Getting Started with Java Foundation--java

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.