Link to home
Start Free TrialLog in
Avatar of andalu123
andalu123

asked on

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.  
Avatar of sciuriware
sciuriware

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!
Avatar of andalu123

ASKER

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?

Avatar of CEHJ
>>
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)


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?
oh, one more thing. where should I place the created jar file and how do I execute it.
ASKER CERTIFIED SOLUTION
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thank you once again CEHJ
:-)
do I have to add this jar file to the classpath to execute it.
No
you rock!