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