Create a Hello World module

Create a Hello World module

We will now go through the creation of a module that will be the placeholder for a very simple program.

  • Name the module "Hello World" and put it in a helloworld directory under the root directory (compmodels) of the project.
addmodule
  • Accept to create a source directory named "src". Accept the default location for the compiler output path (classes). Your configuration will then look as follow:
paths
  • Create a new class by right-clicing on Hello World->helloworld->src and give it the name "HelloWorld".
newclass
  • Write the most simplistic program, such as:
        public class HelloWorld {
            public static void main(String[] args) {
                System.out.println("Hello World!");
            }
        }
  • Click on the down arrow in the tool bar and select "Edit Configurations". Add a configuration by clicking on the + button and name it "Hello World!". The main class should be HelloWorld and it should use the classpath and JDK of module "Hello World".
configurations
  • You are now ready to execute the program by selecting in the menu Run->Run... You should get a an output similar to this one:
helloworld