• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 259
  • Last Modified:

creating a jar

I have .java and .class file which I wanted to jar.  

They are located at c:/myjava/csci4311/ftp/

I tried creating a jar file with instruction found on the web and it gives me an error saying it can't find the main.  What am I doing wrong.

The manifest has myjava.csci4311.ftp for the main class

The class where main exists is FTPClient.class which is located under the directory mentioned above.  
0
andalu123
Asked:
andalu123
  • 6
  • 4
1 Solution
 
sciuriwareCommented:
The manifest should probably say:  myjava.csci4311.ftp.FTPClient

You should 'stand' in C:\ to practise:

jar cvmf <jarfile desired> <where's the manifest file?> myjava

;JOOP!
0
 
andalu123Author Commented:
shouldn't it be
jar  -cvmf  <where's the manifest file?> <jarfile desired> myjava

Wouldn't this command jar everything under myjava?

All I wanted to jar is the files under the folder I mentioned before.

does manifest has to be .txt? I have it as .mf.  does it matter.  Does the manifest has to be under c:/myjava/csci4311/ftp/
along with other stuff I want to jar?

0
 
CEHJCommented:
>>
shouldn't it be
jar  -cvmf  <where's the manifest file?> <jarfile desired> myjava
>>

Yes it should

>>Wouldn't this command jar everything under myjava?

Yes it would

If your code has defined

package myjava.csci4311.ftp;

then you should start your jarring from the parent of myjava

jar  -cvmf  <where's the manifest file?> <jarfile desired> myjava\csci4311\ftp\FTPClient.class

if you only want the one file in there (excluding manifest of course)


0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
andalu123Author Commented:
okay

my package is csci4311.ftp

Can you please provide me step by step instructions to jar the .class, .java and maifest files.  And where should I stand when I am using the command to jar. at c: or c:/myjava.  Also should the manifest be .mf or .txt.  If I wanted run the jar I need the manifest right?  Should it be placed under the c:/myjava/csci4311/ftp/ along with other files which I want to jar?

Can you please also provide what should manifest file include based on what I have mentioned so far.

My main class takes one argument.  Will I be able provide that argument when I am running the program using the jar?
0
 
andalu123Author Commented:
oh, one more thing. where should I place the created jar file and how do I execute it.
0
 
CEHJCommented:
>>Also should the manifest be .mf or .txt.

Doesn't matter

>>If I wanted run the jar I need the manifest right?

To run as an executable jar, yes. You can write the manifest in myjava

C:\myjava>jar cvfm my.jar my.mf csci4311\ftp\FTPClient.class
0
 
andalu123Author Commented:
Thank you once again CEHJ
0
 
CEHJCommented:
:-)
0
 
andalu123Author Commented:
do I have to add this jar file to the classpath to execute it.
0
 
CEHJCommented:
No
0
 
andalu123Author Commented:
you rock!
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 6
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now