Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Jar file preparation

 
Aloke Das
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I developed a java programm by useing JBuilder 5.0 and it kept in a package such as 'eis' and other class files remained in classes subdirector of 'eis'. There is a WelcomeFile that I want to come first. Will I need to cut of all classes main method excepting WelcomeFiel? How can I take the WelcomeFile into manifest file? What will be the command for 'jar'?
 
Hameem Ismail SN
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need not cut any main method from ur class files. U have to create the jar file with manifest inside. That manifest should specify which class file to be executed(ie,which class's main method).
create jar file as
jar cmf <name of the jar> manifest.mf <list of class and other files>
Manifest file should contain following text
Main-Class:WelcomeFiel
Run the jar file as
java -jar <name of the jar>
 
Payam Fard
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
After you create the jar file, you can change the manifest file as follows:
Create a text file containig only the following line, say you name it change.txt:
Main-Class: WelcomeFile
Then you can run the following command to modify the manifest file:
jar umf yourApp.jar change.txt
Now, you can run the application using the following command:
java -jar yourApp.jar
It would go to the Welcome file's main now.
Good luck,
Payam.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic