aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes jar questions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "jar questions" Watch "jar questions" New topic
Author

jar questions

Sandra Baker
Greenhorn

Joined: Jul 10, 2002
Posts: 26
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:
dennis hu
Ranch Hand

Joined: Aug 27, 2002
Posts: 40
Hi:
You must add ":" and have a space like,
Main-Class: Test.
Sandra Baker
Greenhorn

Joined: Jul 10, 2002
Posts: 26
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
Samual Harvey
Ranch Hand

Joined: Aug 06, 2002
Posts: 119
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 ]

Samual Harvey<br />SCJP2<br />SCJD2
dennis hu
Ranch Hand

Joined: Aug 27, 2002
Posts: 40
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~
 
 
subject: jar questions