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

EJB in J2EE? , EJB 2.x is broadly adopted server side component architectu...

EJB 2.x is broadly adopted server side component architecture for J2EE. 1. EJB is a remote, distributed multi-tier system and allows protocols like IIOP, JRMP, and HTTP etc.

Describe tostring() methods, Describe toString() Methods ? Print method...

Describe toString() Methods ? Print methods are general in some languages, but most Java programs operate differently. You can use System.out.println() to print any object. The

Write an aspect that counts different kinds of method calls, Problem statem...

Problem statement Part 1 Write an aspect that counts different kinds of method calls in a Java program. Your aspect should meet the following requirements:  The aspect should ma

Differentiate uni-processor os from multi-processor os, Differentiate uni-P...

Differentiate uni-Processor OS from Multi-Processor OS? Uni-processor OS : Uni-processor OS'es is designed to schedule tasks on a single uPs just whereas Multiprocessor O

Logic circuit, Design a logic circuit to convert Gray code to Binary code a...

Design a logic circuit to convert Gray code to Binary code and draw the logic circuit.

I need java expert with tomcat tuning experience, I need Java expert with t...

I need Java expert with tomcat tuning experience Project Description: Require a Java expert to fix memory issues with tomcat. Skills required: Java, Apache

Online doctor, can you explain me the er diagram for the online doctor syst...

can you explain me the er diagram for the online doctor system

Pattern printing program, Question Using 3 level of nested for loop, writ...

Question Using 3 level of nested for loop, write a program that will produce the output as below.

Program, write a program in java which enters name,roll #,and shows the sum...

write a program in java which enters name,roll #,and shows the sum of students english and maths marks?

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