How to create jar file, executable jar file through command prompt:

How to create jar file, executable jar file through command prompt:

C:\Documents and Settings\madhusudhanrc\
Desktop>javac OverriddenSample.java

C:\Documents and Settings\madhusudhanrc\
Desktop>java OverriddenSample
Yahooo

C:\Documents and Settings\madhusudhanrc\
Desktop>jar cf test.jar OverriddenSample
.class

C:\Documents and Settings\madhusudhanrc\
Desktop>java -jar test.jar
(Error)  no main manifest attribute, in test.jar

To avoid that error :
create abc.txt file

Main-class: OverriddenSample (and give enter)

Now save the file




C:\Documents and Settings\madhusudhanrc\
Desktop>jar cfm test.jar abc.txt Overrid
denSample.class

C:\Documents and Settings\madhusudhanrc\
Desktop>java -jar test.jar
Yahooo

Comments

Popular posts from this blog

Android Objective type Question and Answers

Android Questions and Answers for written exams

Android Interview questions