+ All Categories
Home > Documents > How to run Java program with tester library using NetBeans ...€¦  · Web viewHow to run Java...

How to run Java program with tester library using NetBeans ...€¦  · Web viewHow to run Java...

Date post: 21-Nov-2019
Category:
Upload: others
View: 10 times
Download: 0 times
Share this document with a friend
9
How to run Java program with tester library using NetBeans IDE. Download and install NetBeans. Decide where you will keep your work and define two folders/directories, one for the project workspace and one for the libraries you will use. We will name them NetBeansWorkspace and NetBeansJars. Start NetBeans. Your workspace should look like this: In File menu select New then Java then Java Application:
Transcript
Page 1: How to run Java program with tester library using NetBeans ...€¦  · Web viewHow to run Java program with tester library using NetBeans IDE. Download and install NetBeans. Decide

How to run Java program with tester library using NetBeans IDE.

Download and install NetBeans. Decide where you will keep your work and define two folders/directories, one

for the project workspace and one for the libraries you will use. We will name them NetBeansWorkspace and NetBeansJars.

Start NetBeans. Your workspace should look like this:

In File menu select New then Java then Java Application:

Page 2: How to run Java program with tester library using NetBeans ...€¦  · Web viewHow to run Java program with tester library using NetBeans IDE. Download and install NetBeans. Decide

Choose the project name (e.g. Project1), select to Next. A window will ask you to choose the location for your project. Select the

NetBeansWorkspace folder.

Name the project Project1 and Browse to select the project location.

Page 3: How to run Java program with tester library using NetBeans ...€¦  · Web viewHow to run Java program with tester library using NetBeans IDE. Download and install NetBeans. Decide

Check the button Use Dedicated Folder for Storing Libraries then Browse. It will then ask you for the location of the libraries you want to use. Select NetBeansJars. (Our example shows EclipseJars – as we share these with the Eclipse projects.)

Check Set as Main Project, and Finish. In the Projects tab hit the triangle next to Project1, then again next to Source

Packages.

Page 4: How to run Java program with tester library using NetBeans ...€¦  · Web viewHow to run Java program with tester library using NetBeans IDE. Download and install NetBeans. Decide

In the File menu choose New File. In the left pane select Java, then select Empty Java File.

Choose the name for the class --- Shapes and Finish.

Page 5: How to run Java program with tester library using NetBeans ...€¦  · Web viewHow to run Java program with tester library using NetBeans IDE. Download and install NetBeans. Decide

Copy and paste the file Shapes.java into the center pane that now has a label Shapes.java. You should see the following in the center pane:

Save the file, by selecting Save in the File menu, or by using the Save button in the toolbar. You can edit the file as you wish – maybe adding a comment about the author, or today’s date.

However, your program still shows a number of errors. You need to tell the Project where to find the tester library. In File menu select Project Properties (Project1).

In the left pane select Libraries.

Page 6: How to run Java program with tester library using NetBeans ...€¦  · Web viewHow to run Java program with tester library using NetBeans IDE. Download and install NetBeans. Decide

On the right select Add JAR/Folder in the window that appears select tester.jar.

If you want to use the World libraries, select also the three additional jars: draw.jar, geometry.jar, and colors.jar.

When you get back to the Project Properties window, select Run in the left pane.

Page 7: How to run Java program with tester library using NetBeans ...€¦  · Web viewHow to run Java program with tester library using NetBeans IDE. Download and install NetBeans. Decide

Type in the name of the Main class as tester.Main, then hit Apply and Run. You will see the results. They indicate some errors to be fixed. At any time, if you

double-click inside of one of the windows (Java file, Output), it will appear as a full size window. If you double-click again, it will return back to its original position and size within the NetBeans workspace.

In the inexact comparisons both pieces of data should be of the type double. Fix it and run again. To run again just hit the green Run button in the toolbar, as long as your Java program file is currently showing in the main pane. You should see success.


Recommended