Java.util.jar.JarEntry class in Java Last Updated : 12 Sep, 2023 Comments Improve Suggest changes Like Article Like Report This class is used to represent a JAR file entry. Constructors : JarEntry(JarEntry je) : Creates a new JarEntry with fields taken from the specified JarEntry object. JarEntry(String name) : Creates a new JarEntry for the specified JAR file entry name. JarEntry(ZipEntry ze) : Creates a new JarEntry with fields taken from the specified ZipEntry object. Methods: Attributes getAttributes() : Returns the Manifest Attributes for this entry, or null if none. Syntax :public Attributes getAttributes() throws IOException Returns: the Manifest Attributes for this entry, or null if none Certificate[] getCertificates() : Returns the Certificate objects for this entry, or null if none. Syntax :public Certificate[] getCertificates() Returns: the Certificate objects for this entry, or null if none. CodeSigner[] getCodeSigners() : Returns the CodeSigner objects for this entry, or null if none. Syntax :public CodeSigner[] getCodeSigners() Returns: the CodeSigner objects for this entry, or null if none. Methods inherited from class java.util.zip.ZipEntry clone, getComment, getCompressedSize, getCrc, getExtra, getMethod, getName, getSize, getTime, hashCode, isDirectory, setComment, setCompressedSize, setCrc, setExtra, setMethod, setSize, setTime, toString Methods inherited from class java.lang.Object equals, finalize, getClass, notify, notifyAll, wait, wait, wait Note: The programs will not run on online IDE as they are not able to read file Program 1: Java //Java program demonstrating JarEntry method import java.io.FileInputStream; import java.io.IOException; import java.io.PrintStream; import java.util.jar.JarEntry; import java.util.jar.JarInputStream; class JarEntryDemo { public static void main(String[] args) throws IOException { FileInputStream fis = new FileInputStream("codechecker.jar"); JarInputStream jis = new JarInputStream(fis); JarEntry je=jis.getNextJarEntry(); PrintStream out = System.out; //illustrating getAttributes out.println(je.getAttributes()); //illustrating getCodeSigner out.println(je.getCodeSigners()); //illustrating getCertificates out.println(je.getCertificates()); } } Program 2: Java //Java program demonstrating JarEntry method package java.util.jar; import java.io.IOException; import java.util.zip.ZipEntry; import java.security.CodeSigner; import java.security.cert.Certificate; public class JarEntry extends ZipEntry { Attributes attr; Certificate[] certs; CodeSigner[] signers; public JarEntry(String name) { super(name); } public JarEntry(ZipEntry ze) { super(ze); } public JarEntry(JarEntry je) { this((ZipEntry)je); this.attr = je.attr; this.certs = je.certs; this.signers = je.signers; } public Attributes getAttributes() throws IOException { return attr; } public Certificate[] getCertificates() { return certs == null ? null : (Certificate[]) certs.clone(); } public CodeSigner[] getCodeSigners() { return signers == null ? null : (CodeSigner[]) signers.clone(); } } Comment More infoAdvertise with us Next Article Java.util.jar.JarEntry class in Java N Nishant Sharma Improve Article Tags : Java Practice Tags : Java Similar Reads Java.util.jar.JarInputStream class in Java The JarInputStream class is used to read the contents of a JAR file from any input stream. It extends the class java.util.zip.ZipInputStream with support for reading an optional Manifest entry. The Manifest can be used to store meta-information about the JAR file and its entries. Constructors JarInp 3 min read Java.net.JarURLConnection class in Java Prerequisite - JAR files in Java What is a Jar file? JavaArchive(JAR) bundles all the classes in one package. Since the archive is compressed and can be downloaded in a single HTTP connection, it is often faster to download the archive than to download individual classes. Although jar bundles all th 4 min read Java.lang.Runtime class in Java In Java, the Runtime class is used to interact with Every Java application that has a single instance of class Runtime that allows the application to interface with the environment in which the application is running. The current runtime can be obtained from the getRuntime() method. Methods of Java 6 min read Java.util Package in Java Java.util PackageIt contains the collections framework, legacy collection classes, event model, date and time facilities, internationalization, and miscellaneous utility classes (a string tokenizer, a random-number generator, and a bit array).Following are the Important Classes in Java.util package 4 min read Java.lang.Package Class in Java In Java, the package class was introduced in JDK 1.2 to encapsulate version data associated with a package. As the number of packages increases, knowing the version of the package has become important. This versioning information is retrieved and made available by the ClassLoader instance that loade 9 min read Java Class vs Interfaces In Java, the difference between a class and an interface is syntactically similar; both contain methods and variables, but they are different in many aspects. The main difference is, A class defines the state of behaviour of objects.An interface defines the methods that a class must implement.Class 5 min read Java.lang.Class class in Java | Set 1 Java provides a class with name Class in java.lang package. Instances of the class Class represent classes and interfaces in a running Java application. The primitive Java types (boolean, byte, char, short, int, long, float, and double), and the keyword void are also represented as Class objects. It 15+ min read java.lang.reflect.Field Class in Java The ability of the software to analyze itself is known as Reflection. This is provided by the java.lang.reflect package and elements in Class .Field serves the same purpose as the whole reflection mechanism, analyze a software component and describe its capabilities dynamically, at run time rather t 5 min read Runtime JAR File in Java JAR stands for Java Archive file. It is a platform-independent file format that allows bundling and packaging all files associated with java application, class files, audio, and image files as well. These files are needed when we run an applet program. It bundles JAR files use a Data compression alg 4 min read Object Class in Java Object class in Java is present in java.lang package. Every class in Java is directly or indirectly derived from the Object class. If a class does not extend any other class then it is a direct child class of the Java Object class and if it extends another class then it is indirectly derived. The Ob 7 min read Like