Java uses pure command line to package projects

Source: Internet
Author: User

1:javac-d the compiled class file output directory Specifies the source file location. For example

For multiple packages under the source code compilation, it seems that Javac does not support iterative compilation, may need to pass through multiple source location to compile. One convenient way is to use the Windows Bat script or the Linux shell script as a compile source file list and then compile according to the source file manifest, for example:

DIR/S/B *.java> sources.txt

The resulting sources.txt format is as follows:

 

Then use:

javac-d classes @sources. txt

To complete the compilation. The source files in the current example do not involve dependency issues, and there is no need to consider the order of the source files in Sources.txt when there are dependencies. Because the compiler will automatically compile dependent source files at compile time when it finds that the class used does not compile.

Create jar packages can be packaged using the JAR-CVF Jarname.jar class folder

Running a Java package can use Java-classpath Jarname.jar mainclass

Java uses pure command line to package projects

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.