excutable jar file

I have read some articles, and followed those step, but wasn't successful.
I have WebCrawler.class and CrawlerException.class under same dir.
I created myManiFest and content the following lines

Manifest-Version: 1.0
Main-Class: WebCrawler

In the same dir, I created jar file by typing the following:

jar cmf myMiniFest dkim18.jar WebCrawler.class CrawlerException.class

and got dkim18.jar file, but when I excuted the jar file by typing

java -jar dkim18.jar

I have "NoClassDefFoundError"

What did I do wrong?

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

Is the WebCrawler class in a package? If so, that should be reflected in the Main-Class declaration
dkim18Author Commented:
Yes, WebCrawler class in a package

package dkim18.crawler;

So, I changed myManiFest file like this:

Manifest-Version: 1.0
Main-Class: dkim18.crawler.WebCrawler

But, still have same problem.
Try putting a couple of blank lines after the Main-Class in the manifest (this was a bug).

Go through each step carefully - it;s easy to make an error.
Fundamentals of JavaScript

Learn the fundamentals of the popular programming language JavaScript so that you can explore the realm of web development.

dkim18Author Commented:
Actually, a little different err msg, but same " NoClassDefFoundError" error.
dkim18Author Commented:
I put a couple of blank lines after the Main-Class in the manifest and went through again.
but same error.
Should I make myManiFest excutable?
This is what i did step-by-step

1. Create following manifest and save as mf.txt

Manifest-Version: 1.0
Main-Class: dkim18.crawler.WebCrawler

2. Create and compile class

javac dkim18/crawler/WebCrawler.java

3. Create jar

 jar -cfm   dkim18.jar mf.txt ./dkim18/crawler/WebCrawler.class

4. Run it

java -jar dkim18.jar

Mick BarryJava DeveloperCommented:
you need to include all the required application classes in your jar with the matching directory structure.

from the directory containing the dkim18 directory run:

jar -cfm   dkim18.jar mf.txt dkim18/crawler/WebCrawler.class dkim18/crawler/CrawlerException.class

The follwoing can be used if there are only two classes in the crawler directory:

jar -cfm   dkim18.jar mf.txt dkim18/crawler/*.class

And ensure your Main-Class attribute contains the fully qualified classname as mentiuoned above.

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
Mick BarryJava DeveloperCommented:
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

From novice to tech pro — start learning today.