• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

jar questions

 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I am trying to jar my files, but have the following problems, any help would be very appreciated......
1. can I jar classes and a pakage in one jar file? (e.g. Test1.class, Test2.class, PackageTest). What is the proper syntex for this? I tried this, but did not work:
jar -cfm Test1.class Test2.class PackageTest.*
do I need to type every single .class in PackageTest (for example, PackageTest.myClass1 PackageTest.myClass2........)?
2. about make executable jar: I read one post in this forum said that steps are as following:
a.Create the java Program and compile It.
b.Make a manifest file(eg:Manifest.mf) as follows:
Main-Class: <class file name which has the main method>eg: Main-Class: Test
c.Make the jar file:jar -cfm <Filename>.jar <Manifestfile> <list of classes in the java program>
So, I tried, and got the error message:
E:\scjd>Main-Class FBApp
'Main-Class' is not recognized as an internal or external command, operable program or batch file.
Can someone help me to know how to solve this? Thanks :roll:
 
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi:
You must add ":" and have a space like,
Main-Class: Test.
 
Sandra Baker
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the reply. However, I tried both
(with and without space), both did not work.
E:\scjd>Main-Class: FBApp
'Main-Class:' is not recognized as an internal or external command,
operable program or batch file.
E:\scjd>Main-Class:FBApp
The filename, directory name, or volume label syntax is incorrect.
Do i need to add anything to my jdk? cause I think it does not recognize "Main-Class: " command.... Thks
 
Ranch Hand
Posts: 119
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Sandra Baker:
Thanks for the reply. However, I tried both
(with and without space), both did not work.
E:\scjd>Main-Class: FBApp
'Main-Class:' is not recognized as an internal or external command,
operable program or batch file.
E:\scjd>Main-Class:FBApp
The filename, directory name, or volume label syntax is incorrect.
Do i need to add anything to my jdk? cause I think it does not recognize "Main-Class: " command.... Thks


Make sure that the class name uses the same package where it is in:-
example:-
package sun.client;
public class FBApp{
}
Then ur manifest file should be like this:-
Manifest-Version: 1.0
Created-By: 1.2.2 (Sun Microsystems Inc.)
Main-Class: sun.client.FBApp
<empty line>
Thanks.
[ September 06, 2002: Message edited by: Samual Harvey ]
 
dennis hu
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Sandra :
I agree with Smual,the jdk is ok and you need to write the fully class name includes all package,
like:
Main-Class: suncertify.server.FBNServer
~dennis hu~
 
The harder you work, the luckier you get. This tiny ad brings luck - just not good luck or bad luck.
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic