Chapter 2 Javac compilation principles and javac compilation principles
Note: This article mainly records from the "in-depth analysis of java web technology insider" Chapter 4 javac compilation principles"
1. Functions of javac
Convert *. java source code file to *. class File
2. compilation process
Process:
Lex
Recently to start learning j2se, you need to install jdk-8u60-windows-x64 software, but after installation, enter the Javac prompt in the command box such as:After adding the following path, the problem is still not resolved:Then view the Bin folder under the installation directory (no Javac files found) such as:Find solutions After:In the second selection of the installation directory to install the JRE du
Unable to find a javac compiler; com. Sun. Tools. javac. Main is not on the classpath. Perhaps java_home does not point to the JDK ()
Solution:Java_home (Java installation directory)/lib/tools. JarCopy to tomcat_home (tomcat installation directory)/common/lib and restart tomcat.
Causes and solutions:
When Tomcat is installed, the JRE path is specified. As a result, atat_home and java_home have been added
1. Problem: Running Javac report Javac is not an internal or external command, but running Java, java-version normal?See if the following three environment variables are set correctly:(1) environment variable java_homeSet Java_home as the JDK installation path, as follows:(2) environment variable PATH(3) environment variable CLASSPATHSummarize:CLASSPATH.;%java_home%\lib; (Note: Front pastry, semicolon, back
6. javac commands and javac commandsJavac [options] [sourcefiles] [@ files] parameters can be arranged in any order. Options command line options. Sourcefiles one or more source files to be compiled (for example, MyClass. java ). @ Files one or more files listing source files. 1. View commands
-G
Generate all debugging information
-G: none
No debugging information is generated
I've never had a JDK before. Today's situation, a variety of solutions to try the afternoon, finally came out, say the solution: Java_home, classpath are all in the system variables set up; Java_home Add the JDK installation directory, note java_home to write correctly: Do not add semicolons behind the installation directory. The corresponding value of classpath is .; %java_home%\lib\dt.jar;%java_home%\lib\tools.jar Note This place don't miss the front point. Add after the original path v
This is an environment variable problem. follow these steps:1. Environment variable settings:In system variables (or user variables), click Create:
Variable name: java_home
Variable value: C: \ Program Files \ Java \ jdk1.6.0 _ 10
Click New again:
Variable name: classpath
Variable value:.; % java_home % \ Lib \ tools. Jar
And add it to the path (do not delete the original ones); C: \ Program Files \ Java \ jdk1.6.0 _ 10 \ bin
Then execute the Java and javac
Java-version javac-version Version inconsistency The system first installed the jdk1.8, the environment variable is configured Jdk1.8,java-version and javac-version version of the same. Then installed the jdk1.7, the environment variable java_home changed to 1.7, but the cmd input java-version and javac-version Version is not consistent, one is java-version displ
When you compile your project with ant, you receive the following error:
An exception occurred in the [javac] Compiler (1.5.0_12). If the error is not found in the bug Parade, archive the error in Java Developer Connection (http://java.sun.com/webapps/bugreport). Please include your program and the following diagnostic information in the report. Thank you for your cooperation.[Javac] Java.lang.OutofMemory:
Read Catalogue
Java JDK Installation
PATH
CLASSPATH
Summary
Javac command
Java commands
Summary
Build Jar Package
One, Java JDK installation1) The JDK will be installed two times during installation, the 1th time is to install the JDK, and the 2nd time to install the JRE. I installed the JDK under the D:\Java\jdk\ path and installed the JRE under the D:\Java\jre\ path.2) When configuring the values for Paht an
Programming | Compiling JAVAC-----Java programming language compiler
* Summary
* Description
* Lookup Type
* File List
* Option
* Example
* Please refer to
synopsis[Summary]
javac [Options] [SourceFiles] [@files]
Oldjavac [Options] [soucefiles] [@files]
parameter suspicious bit arbitrary order
Options
Command line Options
SourceFiles
one or more of the original files
@files
Document directory
Associated editing options
Non-standard options
Compile a simple program
Compile multiple source files
Specify user class path
Separate source files from class files
Code examples
Structure
javac [ options ] [ sourcefiles ] [ @files ]
Parameters can be arranged in any order.
options
Command line options.
sourcefiles
One or more source files to be compiled (for example,
One, Java and Javac command line(1) Javac command lineJavac.exe for compiling Java source files, generating. class filesSyntax: javac [option] SourceCommon [option] options:A,-classpath Will overwrite the classpath settingsB,-D (2) Java command lineJava.exe used to run the. class file generated after Javac compilationS
Four Javac compilation processes
?? The Javac compilation process is roughly divided into four processes:Lexical Analysis syntax analysis semantic analysis code generation lexical analysis
?? Lexical analysis is to transform the Token stream of the source code into a Token set. A single character is the smallest element in the programming process, while a tag is the smallest element in the compilation proce
Assume that two Java source files are stored in D: \ java: MyJava. java and Fighting. java.MyJava. java is as follows:Public class MyJava {Public static void main (String [] arr){System. out. println ("MyJava ");}}Fighting. java is as follows:Package mxw. ly;Public class Fighting {Public static void main (String [] arr){System. out. println ("learn to use java and javac commands ");}}
Javac commandCompile a
Here's a note on zookeeper compiling some details on the source code.There's a lot on the web about how to use ant Eclipse to build a record of the eclipse project that zookeeper corresponds to. It's not too much to repeat here. Just a brief explanation.Here's how to compile the Zookeeper project without using any tools directly using Javac, and run it directly using Java.I. Using ANT to Build a Eclispe engineering compilation method is very simple. J
What is Javac?
Javac is a compiler that can speak a language specification into another language specification. such as c,c++ is the source code directly compiled into the target machine code, the target machine code is directly executed by the CPU instruction set. These instruction sets are the underlying language specification, and the machine is able to directly identify the language specification,
();}/* b.java*/Package AAA.BBB.CCC;public class b{}How do I fill in the parameters when compiling? I write according to the format of the package+ file name,Javac Aaa.bbb.ccc.a.javaPretty, huh? Pity not to work. Do not use a valid path name:Javac AAA/bbb/CCC/A.javaBut you find that the generated. class and. Java files are in the same directoryEquivalent to executing command javac-d. Aaa/bbb/ccc/a.javaThe
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.