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.  
andalu123Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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!
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?

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)


Exploring SharePoint 2016

Explore SharePoint 2016, the web-based, collaborative platform that integrates with Microsoft Office to provide intranets, secure document management, and collaboration so you can develop your online and offline capabilities.

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?
andalu123Author Commented:
oh, one more thing. where should I place the created jar file and how do I execute it.
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
andalu123Author Commented:
Thank you once again CEHJ
CEHJCommented:
:-)
andalu123Author Commented:
do I have to add this jar file to the classpath to execute it.
CEHJCommented:
No
andalu123Author Commented:
you rock!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.