Here, is what a default manifest file looks like – Although the default manifest file contains just two entries, but complex manifest files can have way more. Default manifest file is named as MANIFEST.MF and is present in the META-INF subdirectory of archive. Each JAR file have a manifest file by default. It’s a better practice to use -v option along with jar command as you will get to know how the things are going on.Įach JAR file contains a manifest file that describe the features of the archive. The output of above command will be somewhat like this:
In windows you can also get help about various options of jar command just by typing jar in cmd and then pressing enter, the output will be somewhat similar to this:įor creating a JAR file which have two classes server.class and client.class and a Jpeg image logo.jpeg, one need to write following command : jar cvf chat.jar server.class client.class logo.jpeg The options of jar command are almost similar to that of UNIX tar command. If you supply one or more file names, only those files are extracted Otherwise, all files are extracted. M : Does not create a manifest file for the entries.
Every archive has a default manifest, but you can supply your own if you want to authenticate the contents of the archive. A manifest is a description of the archive contents and origin.
f : Specifies the JAR file name as the second command-line argument.e : Creates an entry point in the manifest.If any of the specified file name are directories, then the jar program processes them recursively. c : Creates a new or empty archive and adds files to it.manifest-file is the name of file which contains manifest of that jar file, giving manifest-file as an argument is entirely optional. file1, file2, file3 : files which you want to add inside a jar file.jar – file : name of jar file on which you want to use jar tool.ISRO CS Syllabus for Scientist/Engineer Exam.ISRO CS Original Papers and Official Keys.GATE CS Original Papers and Official Keys.* A JDBC client program that inserts a row into a MySQL database.
Here’s the package is net.codejava and the Java source file is StudentsInsert.java.Īnd below is source code of the program in the StudentsInsert.java file: package net.codejava
) ENGINE=InnoDB DEFAULT CHARSET=latin1You need to download the JDBC driver library for MySQL in order to run the program. UNIQUE KEY `student_id_UNIQUE` (`student_id`) Here’s the MySQL script to create the database: create database Students The JAR file is an executable JAR.By following this tutorial step by step, you will be able to use the three tools ( javac, jar and java) together fluently in your daily Java programming.The Java program we use in this tutorial is a JDBC client that connects to a MySQL database named Students and inserts a row into the table students.
The Java source file is under a package. This tutorial helps you use the core tools in JDK ( javac, jar and java) to compile, package and run a Java program under the following circumstance: