JAN ORTS
JAN ORTS

Reputation: 63

Running testing class from jar package in NetBeans

I have like 30 Java classes and 1 class for testing in a jar package.

To run the testing class, I need to create new NetBeans project , import all those 30 classes into /src , then import 1 testing class into /test and maybe add some libraries to the project also... So that, after all I will be able to run the testing class...

Is there some other way to do it?

I open the jar package in NetBeans and see all the classes but it doesn't let me run the testing class since there is no main method in there..

Upvotes: 0

Views: 951

Answers (1)

Tim Boudreau
Tim Boudreau

Reputation: 1781

A bunch of ways. If you're in NetBeans, and the class has a public static void main() method you can just right-click it and choose Run File.

But you're far better off writing your test as a JUnit or TestNG test - that way it is not included in your production bits, and continuous build tools and other things will be able to run your tests automatically because they look the way those tools expect.

Upvotes: -1

Related Questions