Newer
Older
labs / tiddlers / content / labs / lab01 / _Labs_01_Exercise_ Create a Project.md

We will start with a simple Java project that prints 'hello world' to the ouput console. We created this project in INFO201 too, but this time we will be using it to explore NetBeans and Gradle a lot more that we did in INFO201.

  1. Start NetBeans 12. It should appear in the <

    > section of the application menu (the blue cross at the bottom left of the screen).

  2. Create a new Gradle project using <

    New Project > Java with Gradle > Java Application">>.

    We will be looking into Gradle a bit more in the next section.

  3. Click <

    >.

  4. Add a <

    >. Using lab01 would be a good choice. This name will be turned into a folder, so it is a good idea to stick to single words with no spaces and all lowercase to avoid problems later on.

    NetBeans will default to storing the project in a folder named <>. That location is fine for this week. We will create a proper Git repository folder next week (you will be given a GitBucket account for INFO202 at the end of this week).

  5. Click <

    >. Note that most IDEs (including NetBeans) need to generate a lot of index files when you create your very first project. It might take a minute or two to complete this. These index files are used to provide the code completion features that we will be using in a later section.

  6. NetBeans will have generated a Main class for you that contains an empty main method. It can be a little bit confusing having both a method and a class with the same name. You should know enough from COMP160 to be able to distinguish between the class and the method. The standard naming conventions can help here --- the class starts with a capital M and the method starts with a lowercase m.

    Add the code that prints hello world to the output console.

    <> Tip: You can use a template --- type sout and hit < Space">>. We will show you how to view the list of templates later in this lab.

  7. Run the class. Right click the class (either in the project pane, or the background of the source window) and select <

    >. You can also use the < F6">> key shortcut to run the file.

    You should see your message appear in the output console.