Chapter 2 Java programming environment and Chapter 2 java programming
2.1 install Java development toolbox 1. Java terminology
- Software used by programmers who compile Java programs using JDK-Java Development Kit
- Software used by users who run Java programs in JRE-Java Runtime Environment
- Update-an update is called when minor version changes are made to solve some urgent problems.
- JDK (including compiler)> JRE> JVM
- Java SE-Java Standard Edition, applicable to the Java platform of desktop or simple server applications
- Java EE-Java Enterprise Edition: a Java platform for complex server applications
2. Install JDK
- In Windows, it is strongly not recommended to install jdk in the directory path to be spaces, such as Program Files
2. Set the execution Path (Path)
- The execution path refers to the directory list of local executable files searched by the operating system.
- Unix (Linux) Setting Method: In ~ /. Bashrc or ~ /. Add: export PATH = jdk/bin: $ Path at the end of the bash_profile File
- In Windows, log on as an administrator and right-click "computer, advanced System settings-> environment variables-> system variables-> Path variables-> set jdk \ bin to the beginning of the variable, and use semicolons to isolate the variable values
- In shell, run javac-version to check whether jdk is successfully installed.
3.installation Library source file (src.zip.pdf and document (jdk-version-apidocs.zip)
1) install jdk and set the execution path. 2) Open the shell window. 3) enter the jdk directory (cd c: \ jdk1.7.0). 4) create a subdirectory src mkdir src cd src 5) run the unzip command: jar xvf .. \ src.zip
1) install jdk and set the execution Path 2) download the compressed file http://www.oracle.com/technetwork/java/javase/downloads, and put it in the jdkdirectory 3) Open the shell window 4) enter the jdk directory 5) run the unzip command jar-xvf jdk-version-apidocs.zip 4. jdk directory description 2.2 select the development environment
2.3 use the command line tool
1) The javac program is a java compiler, which transfers the file Welcome. compile java into Welcome. class 2) command for temporarily canceling the classpath environment variable in Windows: set CLASSPATH = command in Linux: export CLASSPATH =
Send to JVM, And the JVM executes the bytecode that the compiler stores in the class file.
2.4 use the integrated development environment 2.5 run the graphical application 2.6 create and run the applet
- Applet-Java's ability to run an applet in a browser
Javac WelcomeApplet. java // compile the applet code appletviewer WelcomeApplet.html // applet viewer