Common JAVA_JDK tools and commands

Source: Internet
Author: User

Common tools in the bin directory under the JDK installation directory:
1. compilation tool
Javac
2. Running tools
Java
3. compression tools
Jar
4. Document generation tools
Javadoc
5. character encoding and conversion tools
Native2ascii

1. Compile the command:
1. Compile a file
Under the directory, enter javac a. java
Compile multiple files (using spaces in the middle ):
(1) javac a. java B. java c. java
(2) javac *. java
(3) create the sourcefiles.txt file, add the name of the file to be compiled, one line, and run javac @sourcefiles.txt.
2. Place the generated compilation file in a separate folder.
Javac-d cls a. java (put the generated compilation files in the cls folder in the same directory. This directory can be modified, using the directory path relative to a. java)
3. Compile a class that depends on other classes
Javac-classpath cl-d cls a. java (use the class under the cl directory and put the compilation file under the cls file)

Ii. run commands
Java my. hello (a compilation file under my package)
Java-classpath cl my. java
Note: When writing a package, you cannot run the file in the directory where the class file is located, but you can only write the file in the directory at the "upper level)
3. Compression commands (compress and decompress files or folders)
Jar-cvf Compression
Jar-xvf unzip
Example: jar-cvf hello. jar a. class B. class c. class (Compressed)
Jar-cvf lcz. jar lcz (compress the lcz folder in this directory and name it lcz. jar)
Jar-xvf cl \ hello. jar (decompress hello. jar in the cl directory)
Both pressurization and decompression are in the current directory by default.
Iv. Document generation tool compile command www.2cto.com
(Generate an HTML document from the doc help file in the source file)
Javadoc hello. java
Javadoc-d java \ doc-version-author lcz \ src \ lcz. java
V. character encoding and conversion tools
Native2ascii-encoding: name after the original file name is changed

Author: wusahaoshuai

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.