Link to home
Start Free TrialLog in
Avatar of dkim18
dkim18

asked on

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?

Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

Is the WebCrawler class in a package? If so, that should be reflected in the Main-Class declaration
Avatar of dkim18
dkim18

ASKER

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

ASKER

Actually, a little different err msg, but same " NoClassDefFoundError" error.
Avatar of dkim18

ASKER

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?
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
ASKER CERTIFIED SOLUTION
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
8-)