junit as external jar or library

gudii9
gudii9 used Ask the Experts™
on
what is difference bewteen adding junit as external jar or as Libray as attached.

I got error initally saying Error: Could not find or load main class
when i run as juni tclass.

when i added Library then junit 4(earlier it was only added as external jar) i was able to run the test case.

Please advise.
jarsJunit.png
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2016

Commented:
when i run as juni tclass.
Are you saying that you're trying to run JUnit as an app? If so, that's not what you're meant to do

Author

Commented:
In eclipse i was right clicking on the junit class say xyzrtest.java then run as JUnit TEst class then getting error
Top Expert 2016

Commented:
Learn Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

Author

Commented:
run time errOR I am getting is
Error: Could not find or load main class
when i run as junit class by right clicking on that junit class in eclipse.
Top Expert 2016
Commented:
sounds like the app doesn't have the main class set in its configuration in eclipse

Author

Commented:
as it is junit no need of junit right. but it got resolved when i added JUnit Library later(initially i added junit as external library as in screenshot in original question which did not resolve the issue though). my question is difference between adding as Library and adding as external jar?

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial