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
-
Right click on the root package.
-
In the contextual menu, select "
Java Architect/
Create element/
Java Module".
-
Select the created module
-
Let’s name it "com.example" .
1.2. Create a Java package
-
Right click on the java module.
-
In the contextual menu, select Create element→
Package to create a package in the module.
The package is automatically stereotyped " JavaPackage"
-
Select the created package
-
Select the "
Java" view.
-
Use the "UML Name" field to name the package "com.example".
1.3. Create the main class
-
Right click on the created java package.
-
In the contextual menu, select Create element→Class to create a class in the package.
The class is automatically stereotyped " JavaClass"
-
In the "
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:
-
Select the "
com.example" java module.
-
Go to the "
Java" view.
-
Click on the
button to generate the
module-info.java
sources. -
Click on the
button to generate the sources on the whole module content.
3. Edit the MyApp.java source file
-
Select the "MyApp" class.
-
Edit the generated source either:
-
in the integrated editor with the
button,
-
or use your favorite IDE to open the file.
-