Home >Java >javaTutorial >Java overview + environment construction
I have read the basics of Java several times, but I forgot about it after a while, so this time I decided to spend some time organizing it. A series of blogs for easy reference in the future. This series is compiled based on two books on Java programming ideas + Java core technology. These two books are also two books that I highly recommend everyone to read, because each time you read them, you will get different results. The two books are horizontal. Seeing how they complement each other will definitely benefit you a lot, so stay tuned!
##Java was developed by Sun in 1995 An object-oriented programming language launched in May, which implements the object-oriented theory extremely well, pays more attention to the object itself and does not need to pay too much attention to the process of events.
Java consists of four parts: Java programming language + Java class format file + Java virtual machine + Java application program interface. We define different class files through the IDE. Access the resource system by calling the class method (Java API), compile the source file into a .class file, and run the file through the Java virtual machine.
Java White Paper:
1994 Green Project (First Pascal Company) disbanded
May 23, 1995 Java on SunWorld After getting the demonstration, the great Java language was born
In early 1996, Sun released the first version of Java, but the Java1.0 version could not be actually used in development
Java 1.2 version (Standard Edition-J2SE-JavaSE) was released in December 1998. This version is closer to Java's write once and run anywhere concept and was released three days later ( Micro Edition-J2ME-JavaME) and (Enterprise Edition-J2EE-JavaEE)
Released Java1.3 in 2000
Java 1.4 was released in 2002
In 2004, Java made major improvements to the language, which can be described as another major improvement Milestone, and officially named Java 5.0 version, and adding concepts such as generics, foreach loops, enumerations, etc.
Released Java 6 version in 2006
In 2009, Sun's once glorious empire finally fell. After being acquired by Oracle, Java entered a period of stagnation
Java 7 version released in 2011
Java 8 version released in 2014
JDK (Java Development Kit): Programmers who write Java programs Software used
JRE: Software used to run Java programs
IDE: Integrated development environment such as: eclipse, idea, etc.
JDK download address:. Note: The default installation path is under Program Files. It is best to change the path or replace the spaces to avoid unnecessary trouble.
Directory Structure:
bin: Compiler and tools
db: Relational database file developed by Java
include: File used to compile native methods
javafx-src: JavaFX Script is a declarative, statically typed programming language
jre: Java runtime environment file
##lib: Class library file
src: Class library source file
JAVA_HOME: D:\Java\jdk1.8.0_31 It points to the jdk installation directory. Software such as Eclipse/NetBeans/Tomcat searches for the JAVA_HOME variable to find and use the installed jdk.
PATH: %JAVA_HOME%\bin; Its function is to specify the command search path. When executing a command such as javac on the command line to compile a java program, it will go to the path specified by the PATH variable. Search to see if you can find the corresponding command program. We need to add the bin directory under the jdk installation directory to the existing PATH variable. The bin directory contains frequently used executable files such as javac/java/javadoc. After setting the PATH variable, you can enter it in any directory. Execute javac/java and other tools.
CLASSPATH: .;%JAVA_HOME%/lib/dt.jar;%JAVA_HOME%/lib/tools.jar is used to specify the class search path. To use the already written class, The prerequisite is of course that they can be found. The JVM uses CLASSPATH to find classes. We need to set dt.jar and tools.jar in the lib subdirectory under the jdk installation directory to CLASSPATH. Of course, the current directory "." must also be added to this variable.
Environment variable verification:
CMD verification: Enter Java -version and press Enter. The console will output the jdk version number, indicating that the installation is successful. Create a new HelloWorld.java file, enter the corresponding directory, enter javac HelloWorld.java and press Enter, then enter java HelloWorld and press Enter to output Hello World on the console, indicating that the environment variables are configured successfully. Note: The javac program is a Java compiler. It compiles HelloWorld.Java into a HelloWorld.class file and sends it to the Java virtual machine. The virtual machine executes the compiler and places it in the class file. bytecode. Note: When compiling, you need to provide a suffix for the file to be compiled, namely: HelloWorld.java, and when running, you only need to specify the class name, and no suffix is required: HelloWorld. .
The above is the detailed content of Java overview + environment construction. For more information, please follow other related articles on the PHP Chinese website!