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

Implementation of Kruskal’s Algorithm, • A Graph Data Type (including a dis...

• A Graph Data Type (including a display method to show adjacencies) • A Cycle Checker (as described in lecture notes) • An Edge class • A sorting algorithm to sort an array of Edg

Why hub is used in networks, Why hub is used in networks? HUB: Hub is n...

Why hub is used in networks? HUB: Hub is networking component that can be used to connect the networks and it could also be used to extend the size of networks. In a simple way

Java class loaders , Classes are attached into the JVM as they are referenc...

Classes are attached into the JVM as they are referenced by name in a class that is already running in the JVM. So, how is the staring class loaded? The very first class is espec

Programming Project, Design and implement a class called Sphere that contai...

Design and implement a class called Sphere that contains instance data that represents the sphere''s diameter, and include getter and setter methods for the diameter. Include metho

Explain data security management issue, Explain DATA SECURITY Management is...

Explain DATA SECURITY Management issue? All data in the system is extremely critical to its operation, the security of the customer's personal data is most important. Most of t

Write the java rmi interface definition, In the programming assignments, yo...

In the programming assignments, you are going to develop a simple distributed ticket reservation system (DTRS). This system is used by customers (with unique 6-digit customerID s)

Series, Write a Java program to find the sum of 1+3+5+…. , for 10 terms in ...

Write a Java program to find the sum of 1+3+5+…. , for 10 terms in the series.

Create a gui in java, Fill in the necessary parts to create a GUI that use...

Fill in the necessary parts to create a GUI that uses the CardDeck class.  In your GUI you should have a text field for each hand, two buttons and a text area.   Your program s

Minimumself, At a shop of marbles, packs of marbles are prepared. Packets a...

At a shop of marbles, packs of marbles are prepared. Packets are named A, B, C, D, E …….. All packets are kept in a VERTICAL SHELF in random order. Any numbers of packets with thes

Nested For-Loop, I''m having trouble with creating a nested for loop to cre...

I''m having trouble with creating a nested for loop to create a table that displays every number divisible by two within the given value. For example, if the number is 8 then there

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