Service Desk Practitioners Forum
cancel

Web-API couldnot run with java.lang.NoClassDefFoundError

Highlighted
Kazarin Alexand
Outstanding Contributor.

Web-API couldnot run with java.lang.NoClassDefFoundError

Hello all. I cannot run my web-API class.

I tried to run it from CLI such case: java MyClassName
And I got this message: "Exception in thread "main" java.lang.NoClassDefFoundError: MyClassName"
I run it from directory with MyClass file. No package is use. The class file is in attachment.

Any ideas?
http://linkedin.com/in/alexanderkazarin
2 REPLIES
Mike Bush
Acclaimed Contributor.

Re: Web-API couldnot run with java.lang.NoClassDefFoundError

You need to tell JAVA where to find the web-api classes,I normally create a LIB folder inside the one where my class is stored and copy WEB-API.JAR to it.

Then I can invoke JAVA -CLASSPATH=LIB\WEB-API.JAR MyClassName
Kazarin Alexand
Outstanding Contributor.

Re: Web-API couldnot run with java.lang.NoClassDefFoundError

Hello, Mike. I have set CLASSPATH to directory with web-api.jar and invoked java â cp web-api.jar MyClassName and I got the same error: "Exception in thread "main" java.lang.NoClassDefFoundError: MyClassName"
http://linkedin.com/in/alexanderkazarin