Software industry is growing and it will continue to be the largest job provider in the world. Apart from providing large number of jobs, it has the reputation as one of the well paid sectors across the globe.
In such a situation it is quite natural that there is a rush to learn software related subjects and when the rush is more, a good number of tutorials will come up teaching these subjects. Java, one of the most widely used programming languages is gaining more popularity and hence there is a rush for learning java.
As in the case of other related subjects, there are many Java online tutorials also and they teach the lessons with the help of Java videos. Here in this tutorial we will discuss about creating your first java project.
Thus in this effort of creating your first java project, JUnit can be used as a sample project. JUnit is a free and an open source framework. The first step is to get the sample codes (JUnit). Get the same downloaded and save it without extracting it.
Creating the Project
- Select the menu item “File” in Eclipse and then select “New” and then go to “Project”.
- Select “Java Project” and then select “New” to start the new Java Project. A new Java Project Wizard will get opened as shown below.
In this page type “JUnit” in the Project Name field and select J2SE-1.4 in “Use an execution environment JRE” field. Now click on “Finish” Button.
- Expand the JUnit project in the Explorer package and select the source folder src.
- Select the menu item “File” and then “Import”
- Expand “General”, Click “Next” after selecting “Archive” file
- Click the “Browse” button next to the “Archive” field and browse to locate <Downloads>/junit381src.jar. (This step can be performed only if you have downloaded the sample code as mentioned in the beginning of the article).
- Expand the “Root Mode” in the “Import” wizard and press “Deselect All” and then select only JUnit node. Now the elements can be selected and expanded within the JUnit directory on the left pane for viewing individual resources that are being imported in the right pane. Here, you should take care not to deselect any of the resources.
- JUnit project’s source folder should appear in the destination. “Into Folder” and it should be made sure. Now, you can click “Finish”. In the import progress indicator, notice that the imported resources are compiled as they are imported into the workbench. This is because the Build automatically option is checked on the Workbench preferences page.
- Expand the JUnit project and the src folder in the Explorer package to view JUnit packages.