Notice: Undefined offset: 2 in /home/nhth4zhnn5bg/public_html/deegeu/wp-content/themes/Divi/includes/builder/feature/CriticalCSS.php on line 623

Notice: Undefined offset: 2 in /home/nhth4zhnn5bg/public_html/deegeu/wp-content/themes/Divi/includes/builder/feature/CriticalCSS.php on line 623

Notice: Undefined offset: 2 in /home/nhth4zhnn5bg/public_html/deegeu/wp-content/themes/Divi/includes/builder/feature/CriticalCSS.php on line 623

Notice: Undefined offset: 2 in /home/nhth4zhnn5bg/public_html/deegeu/wp-content/themes/Divi/includes/builder/feature/CriticalCSS.php on line 623

Notice: Undefined offset: 2 in /home/nhth4zhnn5bg/public_html/deegeu/wp-content/themes/Divi/includes/builder/feature/CriticalCSS.php on line 623

Notice: Undefined offset: 2 in /home/nhth4zhnn5bg/public_html/deegeu/wp-content/themes/Divi/includes/builder/feature/CriticalCSS.php on line 623

Notice: Undefined offset: 2 in /home/nhth4zhnn5bg/public_html/deegeu/wp-content/themes/Divi/includes/builder/feature/CriticalCSS.php on line 623

Notice: Undefined offset: 2 in /home/nhth4zhnn5bg/public_html/deegeu/wp-content/themes/Divi/includes/builder/feature/CriticalCSS.php on line 623

Notice: Undefined offset: 2 in /home/nhth4zhnn5bg/public_html/deegeu/wp-content/themes/Divi/includes/builder/feature/CriticalCSS.php on line 623

Notice: Undefined offset: 2 in /home/nhth4zhnn5bg/public_html/deegeu/wp-content/themes/Divi/includes/builder/feature/CriticalCSS.php on line 623
How do I create a Java project in NetBeans? - J003 - DeegeU

How do I create a Java project in NetBeans? – J003

by Apr 15, 2015




DeegeU Course

This video is part of a larger free online class called “Free Java Course Online”. You can find more information about this class on “Free Java Course Online” syllabus.

Try at home

  1. Create a project in NetBeans

Transcript – How do I create a Java project in NetBeans?

Alright so we’re gonna start using an IDE from this point forward. So I can walk you through the steps. Using an IDE makes development much easier because it provides code completion, and error checking as you go.

Here first thing I’m going to do is start NetBeans.

Once I’m in Netbeans, I’m going to create a new Java project. A project is just the collection of files used to make an application.

I’ll select, “File”, then “New Project”. This will bring up a dialog window. I’m going to select Maven for the category.

Maven is a tool used to build larger projects. It also makes it much easier to take source code on one machine to another and have a compile. It’s something I recommend that you look into.

All the Java tutorials on DeegeU.com use Maven. There are two tutorials to give you a deeper look at Maven if you like. For the project type, I’m going to select Java application. Hit next.

For the name I’ll use Primitives. You can call it anything you like. This is the name to reference your project. It will use the name for other parts here. You can accept the defaults and click finish. This creates an empty project.

So now we need to add a Java file to edit. Open the “Source Packages” folder. There should be something called a package under the source packages folder. If there isn’t, select default package. This is something that we’re gonna cover in later lessons.

Right click and select “New”. Then select “Java Class”. Name the class “PrimitivesExample” and click finish.

This will create a Java file.

Does it look familiar? It should look similar to the Hello World app we created in last lesson. It’s just missing the main method and the hello world part.

So let’s add the main method. Then at the print statement to say “Hello World”. We just want to test the IDE. The pop-ups you’re seeing as I type are called code completion windows. It’s trying to complete what I type. I’ll just say “test” instead of “Hello World”.

Save the file by going to File and Save. Now let’s run the application. Select “Run”, then “Run Project”. The first time you run this, its gonna ask what class is used for the main method. We only
have one so the choice is pretty easy.

It should compile and run the application in the console window the console is the area at the bottom the of the IDE. It mimics what you’d see if you ran it from a command line. It prints more than normal here, because we’re using Maven to compile.

You can see it printed “test”, so it works.

And that’s how we’re going to create projects for Java applications.

Hey thanks for watching the video!

There’s a quick quiz for this on DeegeU.com if you’d like to gauge how much you learned.

If you like the videos are seeing, please let me know by liking the video and hitting the subscribe button to the DeegeU
channel on YouTube. I’d really appreciate that! If you have concerns or questions please leave them in the comments below or on DeegeU.com.

There’s a poll on the front page of DeegeU.com, so you can let me know what topic is covered next.

Thanks for watching and see in the next video!







Tools Used

  • Java
  • NetBeans

Media Credits

All media created and owned by DJ Spiess unless listed below.

  • No infringement intended

Get the code

The source code for “How to create a Java project in Netbeans?” can be found on Github. If you have Git installed on your system, you can clone the repository by issuing the following command:

 git clone https://github.com/deege/deegeu-java-intro.git

Go to the Support > Getting the Code page for more help.

If you find any errors in the code, feel free to let me know or issue a pull request in Git.

Don’t miss another video!

New videos come out every week. Make sure you subscribe!

Comments

comments

DJ Spiess

DJ Spiess

Your personal instructor

My name is DJ Spiess and I’m a developer with a Masters degree in Computer Science working in Colorado, USA. I primarily work with Java server applications. I started programming as a kid in the 1980s, and I’ve programmed professionally since 1996. My main focus are REST APIs, large-scale data, and mobile development. The last six years I’ve worked on large National Science Foundation projects. You can read more about my development experience on my LinkedIn account.

Pin It on Pinterest

Share This