What is runnable jar archives, JAVA Programming

Assignment Help:

What is Runnable JAR archives

You can run a program stored within the JAR archive that has a main() method like this:

$ java -cp eharold.jar MainClassName
You must use the fully package qualified name. For instance,

$ java -cp eharold.jar edu.poly.utopia.eharold.games.Trivia

The -cp flag adds the jar file to the class path.

In Java 1.2 you can add a Main-Class attribute to a JAR file's manifest so in which the person who runs the program does not requires to know the name of the name of the class with the main() method. This attribute has the subsequent form

Main-Class: edu.poly.utopia.eharold.games.Trivia

Put this line into a file known as (for example) MyManifest.txt. Then use this command line to package the JAR:

$ jar cvmf MyManifest.txt eharold.jar edu
This will copy data from the file MyManifest.txt into the JAR's own manifest file, and add the directory edu to the archive.

To run the program packaged in the jar file eharold.jar you simply type:

$ java -jar eharold.jar
Java will look inside the JAR archive's manifest to search out which class's main() method it should run.


Related Discussions:- What is runnable jar archives

Illustrate RUP? , Rational Unified Process (RUP) is a normal framework ...

Rational Unified Process (RUP) is a normal framework that may be used to define a development process. The software development life cycle has got 4 parts in the following o

What is difference between design and system architecture, What is differen...

What is difference between Design and System Architecture? System Architecture : It is structure of a product or procedure. Design: It is begin of the procedure of devel

Regex , Having trouble with a lab, need to

Having trouble with a lab, need to

Banknote ocr register anti fraud, Project Description: Introduction: ...

Project Description: Introduction: SID C.A. (integradores) is a software company in Venezuela 15 years ago, and we are exploring the possibility of making mobile developments

Need support display tiff in internet explorer, Need support Display TIFF i...

Need support Display TIFF in Internet Explorer without ActiveX plugin I would like to get a client side viewer designed that permits user to view TIFF files on IE 8 and IE 9 bro

XML File Homework, I need help on java homework. Is it possible to know the...

I need help on java homework. Is it possible to know the shortest possible time to get the solution before giving my commitment

Design a bond class, In the lectures, we have written programs for bond pri...

In the lectures, we have written programs for bond pricing in discrete time. We have also talked about the theory for bond pricing and yields in continuous time. In this exercise,

What is setter methods explain with an example, What is Setter Methods expl...

What is Setter Methods explain with an example? Setter methods, also called as mutator methods, merely set the value of a field to a value specified through the argument to the

Pseudocodes, Draw a 5 inch square on the screen using pseudocode

Draw a 5 inch square on the screen using pseudocode

Java developer with spring framework prerequisite, Java developer with spri...

Java developer with spring framework prerequisite from anywhere Let me know that you have proven experience in java with spring frame work. Send some sample data and provide inf

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd