This example shows how to create a new Java 11 application skeleton, generate the sources and edit them.

It assumes you have a Java 11 Modelio project setup. You may look for Create a basic Java 11 project to create one.

1. Create a basic model

1.1. Create the java module

  1. Right click on the root package.

  2. In the contextual menu, select "moduleJava Architect/creationgroupCreate element/jpmsmoduleJava Module".

  3. Select the created module

  4. Let’s name it "com.example" .

1.2. Create a Java package

  1. Right click on the java module.

  2. In the contextual menu, select Create element→standard.packagePackage to create a package in the module.

    Note The package is automatically stereotyped "javapackageJavaPackage"
  3. Select the created package

  4. Select the "module Java" view.

  5. Use the "UML Name" field to name the package "com.example".

1.3. Create the main class

  1. Right click on the created java package.

  2. In the contextual menu, select Create element→Class to create a class in the package.

    Note The class is automatically stereotyped "javaclassJavaClass"
  3. In the "module Java" view, use the "UML Name" field to name the class "MyApp".

2. Generate the sources

Let’s now generate the sources for the model:

  1. Select the "jpmsmodulecom.example" java module.

  2. Go to the "module Java" view.

  3. Click on the Generate module-info button to generate the module-info.java sources.

  4. Click on the Generate sources button to generate the sources on the whole module content.

3. Edit the MyApp.java source file

  1. Select the "MyApp" class.

  2. Edit the generated source either:

    • in the integrated editor with the edit button,

    • or use your favorite IDE to open the file.