Java Basic Syntax < 10 > Jar file

Source: Internet
Author: User

1 jar files            Java archive files, compressed             Jdk/bin jar tool to make jar files              JAR Program Options 1.1 manifest file            Each jar file contains a manifest file that describes the characteristics of the archive manifest           The manifest file is named MANIFEST.MF, which is located in a special Meta-inf directory of the jar file. The smallest standard-compliant manifest file is very simple:           manifest-version:1.01.2 can run the jar file            You can use the E option in the JAR command to specify the entry for the program, which is typically the class you specify when invoking the Java program loader:            jar Cvfe xxx.jar com. Xxx.xxxclass files       to add            Alternatively, you can specify the application's main class,           main-class:com in the manifest. Xxx.xxxclass do not add the extension class to the main class.             either way, the user can simply launch the application with the following command:            Java–jar xxx.jar 1.3 Resources             Image and sound files            text files with message strings and button labels             binary data files, for example, files that describe the layout of a map          The              ClassLoader knows how to search for a class file until it is found on the classpath, archive file, or Web server.            Step:            1 Get a Class object with resources            2 if the resource is an image or sound file, Then you need to call GetResource (filename) to get the resource location as a URL, and then use the GetImage or getAudioClip method for reading               3 Unlike an image or sound file, other resources can use the getResourceAsStream method to read data in a file            1.4 Sealing            Seal the Java package to ensure that no other classes are added to it. If the code uses classes, methods, and fields that are visible to the package, you might want to seal the package. If not sealed, other classes are likely to be placed in the package, which in turn accesses the features visible to the package.            seal a package, you need to put all the classes in the package into a jar file, by default, the package in the jar file is not sealed. You can change the global default setting by adding the following line:           Sealed:true to the main section of the manifest file.  

Java Basic Syntax < 10 > jar file

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.