This section provides you to the creating a jar file through the java source code by using the jar tool command which is provided by the JDK (Java Development Kit). Here, you can learn how to use the jar command, which is used in the dos prompt, in the java source code to perform same operations.
Following program is given for best illustration about using the dos used command in the java source code to perform the appropriate tasks. This program has been used the jar command "jar cf jar-file-name directory-name" in the source code to create a jar file for the given directory. You can also specify the file name(s) to collect it into the jar file format.
Runtime is the class of java.lang.*; package of Java. This class helps application to interface with the environment in which the java application is running.
This method gets the current runtime environment.
This method helps you to run the command of that environment in which your java application is running.
Here is the code of the program:
If you enjoyed this post then why not add us on Google+? Add us to your Circles
Liked it! Share this Tutorial