Joe
Joe

Reputation: 795

Struggling to install/add JUnit plugin in Netbeans IDE 8.0.2

I am new to Netbeans and I am trying to install JUnit in the IDE. I have searched multiple places and can not find a clear answer. I am running Windows8 with the latest updates and Netbeans 8.0.2. I have downloaded the jar file for JUnit opened Tools => Plugins then Downloaded tab. I select the jar file but nothing happens. I have also tried to run the jar file from commandline and double clicked it and nothing happens. I am looking to expand my skills sets by practicing using JUnit so any help would be appreciated.

thank you.

Upvotes: 4

Views: 20222

Answers (4)

Niroshan Ratnayake
Niroshan Ratnayake

Reputation: 3801

I had the same issue and this is how I solved it,

  1. First download the jar file for Junit from this link Junit test jar

  2. Then follow along as shown in the images

    Right click on the Library section on your particular project
    Right click on the Library

    Click on the create button and name Junit(on your preference)->Ok

    enter image description here


    Then select the Library you created and then select Add Jar/folder

    enter image description here

    Then select the .jar file you downloaded before and select Add jar folder

    enter image description here


Now you have setup the Junit library on netbeans

Upvotes: 0

Erich Kitzmueller
Erich Kitzmueller

Reputation: 36977

For some reason I am still using the old 8.0.2 version of Netbeans, and I found out that the install script apparently installs the junit plugin, but not the junit libs. Downloading the following files and adding them as test libs helped:

  • junit-4.13.jar
  • hamcrest-core-1.3.jar

At the time of this writing, they could be found here: https://github.com/junit-team/junit4/wiki/Download-and-Install

Upvotes: 1

Sandeep Chatterjee
Sandeep Chatterjee

Reputation: 3247

I have not used Netbeans for many years now. However, a quick search shows that during the installation process, there is an option of installing JUnit along with Netbeans. The default option(checked) is Install JUnit.

If by any chance, the second option(Do not install JUnit) got checked, you may want to re-install Netbeans again.

enter image description here

Upvotes: 2

WillShackleford
WillShackleford

Reputation: 7008

It is installed by default. To see that it is installed goto Tools -> Plugins -> Installed and search for JUnit. If it is not there, check Tools -> Plugins -> Available Plugins before trying your own download.

To use select any java file in the projects directory, right-click Tools -> Create/Update Tests. This will create a stub test file under Test Packages under your Project in the projects tab. Select the project and right-click for Test to run all the tests or select any file and right-click for the Test File option.

Upvotes: 4

Related Questions