Java Basic notes-preparation before learning Java

Source: Internet
Author: User
Tags clear screen

The next one months I will share with you the notes I learned javase, share is the best teacher, I hope my notes can give you some help.

I will send an article every day, these are the essence of my study of Java, of course, every note I will be carefully modified to make the knowledge point clearer and more understandable.


Summary of Java Prerequisite knowledge points


Software: System software, application software


Interactive mode:

Graphical interface gui=graphical user Interface

command line mode Cli=command lines Interface


The Internet-facing programming language of Java by Sun=stanford University Network 1995


Three technical architectures for Java:

J2ee=java 2 Platform Enterprise Edition Business Edition

J2se=java 2 Platform Standard Edition edition

J2me

Note: Renamed to Javase, Java EE, javame after Java5


Sun has been acquired by Oracle


Java is portable: Just write a Java program that works on any platform, as long as the Java Virtual Machine (Jvm=java) is available on the platform.

Jre=java runtime environment is called Java's operating environment

jre=jvm+ Core Class

To run a program that has been developed, the computer simply installs the JRE.

Jdk=java Development Kit is called the Java Development Kit

Jdk=jre+java Development tools. In other words, the user only needs to install the JRE, the developer need to install the JDK.

Bin directory full binary (binary), the bin in the JDK holds Java development tools


Windowsdos command:

Enter the e-drive: E: Enter

Open the program, direct file name to enter. For EXE files can not write. exe

Dir (directory): Displays folders in the current directory

CD (change directory): Changing directory

Cd. . Return to the top level directory

Cd xxx*: Open the file with the prefix XXX, if there are more than one, open the first

Cd\: Return to current packing directory

MD (Make directory): Create a new Folder

RD (remove directory): Delete a folder, but the folder must be empty or it cannot be deleted

Del: Delete Files

Del *. *: Delete files that meet *. *

del*: Delete all Files

k) help: Show All commands

Help CD: See the CD command

L) CLS: Clear Screen

M) javac-version: View current JDK version

N). Represents the current path


Environment variable Path

The purpose of configuring path is to be able to use Javac and Java tools in any directory;

The purpose of configuring Classpath is to run. class files in any directory without adding the path to the. class file. (works only at run time)

In DOS, if you want to open a program in any directory, you need to configure the environment variable path.

If the AAA is opened under D, the system will be found in the D-disk, if not from the environment variables.

A) Right-click on "My Computer"-Properties-advanced-environment variables-add a semicolon to the folder directory where Javac is located before path.

b) Build the Java Environment summary

c) Download the JDK and install

d) Configuring Environment variables

e) Enter javac-version validation in cmd, if Java information is present, the Java environment is built successfully


Environment variable Configuration Tips

If the path of the javac changes, the paths in path also need to be modified. Then there is a problem, path is not only the path of Javac, but also the path of other system programs, if multiple modifications may cause the system path is inadvertently modified to make the system program can not run the problem. To solve this problem, you need to customize an environment variable, only the new environment variable name in path, and only modify the new environment variable when the path changes, without modifying the system environment variable.

Note: In path, the environment variable name is wrapped in percent, indicating that the environment variable name is inside the% and not the path.

Note: The system is looking for a program from path, so try to put the new environment variable in the header of path.


To configure temporary environment variables

Only valid in the current CMD window, the window will fail at one pass!

Used to debug the program on someone else's computer, copy the JDK to a USB flash drive, and temporarily configure the environment variable in CMD, that is, the path to the JDK.

All settings in the DOS window are temporary and are permanently set in the Visual window.

A) Set: View all environment variables

b) Set path: View environment variable Path

c) Set PATH=XXX: Sets the environment variable path to XXX

Note: The original value is overwritten!

Set path= (optical equals): Delete environment variable path

Set path=xxxx;%path%: Adds a new value based on the original value


Configuring Environment Variables Classpath

The environment variable path holds the paths to the Windows executable file, and Classpath holds the path to the JVM executable file, the path to the. class file. When you run a Java file with the Java class name, you need to set classpath if you want to do so without writing the path.

"Set Classpath=xxx" and "Set classpath=xxx;"

If there is a semicolon, the system will be based on the path specified by the classpath, if there is no specified. class file in the path, and then to the current directory to find. If there is no semicolon, it is only found in the classpath, can not find the error.


Compiling and running

Compile: Javac file name, producing A. class

Note: This class can be run on any machine with a JRE, which shows the portability of Java.

Note: Produces a "class name. Class" File

Run: Java class name

Note: The main function must be in this class, otherwise the report Nosuchmethoderror:main

Note: Javac is a Java compiler that invokes the Javac compiler when calling Javac, detects if the code is wrong, and generates a. class file.

The Java class name calls the JVM and runs the program.

Java Basic notes-preparation before learning Java

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.