Sample-hello-world » History » Revision 5
« Previous |
Revision 5/19
(diff)
| Next »
Henning Blohm, 28.02.2021 13:38
Hello World Web App Sample¶
TBC
This sample application shows how to set up the most basic Java Web application in z2.
Z2 integrates with the Jetty Web container and Web applications on Z2 are really just standard Java EE Web applications. What is unfamiliar for the typical Maven, Gradle, or Ant user is how applications are developed and modularized on Z2. So this sample case is hence more about Web applications as developed on Z2 than it is about Web application development.
Please skip to Step by Step - Or Setting Things Up Yourself unless you just want to see it running.
This sample is stored in the repository z2-samples-hello-world-web.
Prerequisites¶
Z2 has the following Java Version requirements
Z2 Version | Min. Java version required | Max Java version supported | Max language level |
---|---|---|---|
2.1 - 2.3.1 | Java 6 | Java 7 | Java 7 |
2.4 - 2.5 | Java 8 | Java 8 | Java 8 |
2.6 | Java 9 | Java 11 | Java 10 |
2.7 | Java 9 | Java 11 | Java 11 |
2.8 | Java 9 | Java 13 | Java 13 |
2.9b | Java 8 | Java 8 | Java 8 |
2.9.1 | Java 11 | Java 16 | Java 15 |
2.9.1b | Java 8 | Java 8 | Java 8 |
2.10 | Java 11 | Java 18 | Java 18 |
2.10.1 | Java 11 | Java 21 | Java 18 |
master | Java 17 | ? | Java 23 |
Note: Most samples suggest to use the master branch. You may choose another version branch (please check the respective repository).
Make sure you have a corresponding Java Development Kit (JDK) or Java Runtime Environment (JRE) installed. If in doubt, go to Download Java SE.
Note: Running v2.1-v2.3.1 on Java 8 is supported by specifying
com.zfabrik.java.level=7
(or 6, if that is your desired compilation language level) in <home>/run/bin/runtime.properties
. By this the Java compiler version detection does not fall back to a lower level.
Setting up the sample¶
Follow these instructions, if you just want to see it running. Otherwise we recommend skipping this section and rather follow the step by step instructions below.
Here's the really fast version:
mkdir install
cd install
On Mac-OS or Linux run:
wget http://download.z2-environment.net/z2/z2-base-v2.10.zip
unzip z2-base-v2.10.zip
On Windows download the archive and unpack using the Windows explorer. Make sure to unpack into the installation folder previously created.
This will create a folder z2-base.core that contains the complete version 2.9 z2-base installation.
git clone -b v2.8 https://www.z2-environment.net/git/z2-samples-hello-world-web
On Mac OS or Linux run:
cd z2-base.core/bin
./gui.sh
On Windows run:
cd z2-base.core\bin
gui.bat
(In order to check that z2 is up, when you see "Completed home process initialization", try http://localhost:8080/adm with user "z*" and password "z".)
The first time you launch the sample, it will take a while to download all required resources.
Step by Step - Or Setting Things Up Yourself¶
In this section we will manually create the basic structure of a Z2 module and see how it is discovered by Z2 during development.
We assume that you have prepared some development workspace install and that you installed z2-base.core, the core runtime of z2 in that folder. If you have not done so yet, run
mkdir install
cd install
On Mac-OS or Linux run:
wget http://download.z2-environment.net/z2/z2-base-v2.10.zip
unzip z2-base-v2.10.zip
On Windows download the archive and unpack using the Windows explorer. Make sure to unpack into the installation folder previously created.
This will create a folder z2-base.core that contains the complete version 2.9 z2-base installation.
Create a Module¶
Change into install and create a folder z2-samples-hello-world-web and in that folder create the following structure
In this section we will manually create the basic structure of a Z2 module and see how it is discovered by Z2 during development.
We assume that you have prepared some development workspace install and that you installed z2-base.core, the core runtime of z2 in that folder. If you have not done so yet, run
mkdir install
cd install
On Mac-OS or Linux run:
wget http://download.z2-environment.net/z2/z2-base-v2.10.zip
unzip z2-base-v2.10.zip
On Windows download the archive and unpack using the Windows explorer. Make sure to unpack into the installation folder previously created.
This will create a folder z2-base.core that contains the complete version 2.9 z2-base installation.
Create a Module¶
Change into install and create a folder z2-samples-hello-world-web and in that folder create the following structure
In this section we will manually create the basic structure of a Z2 module and see how it is discovered by Z2 during development.
We assume that you have prepared some development workspace install and that you installed z2-base.core, the core runtime of z2 in that folder. If you have not done so yet, run
mkdir install
cd install
On Mac-OS or Linux run:
wget http://download.z2-environment.net/z2/z2-base-v2.10.zip
unzip z2-base-v2.10.zip
On Windows download the archive and unpack using the Windows explorer. Make sure to unpack into the installation folder previously created.
This will create a folder z2-base.core that contains the complete version 2.9 z2-base installation.
Create a Module¶
Change into install and create a folder z2-samples-hello-world-web and in that folder create the following structure
├── java │ ├── src.api │ ├── src.impl │ └── z.properties └── web ├── WebContent │ └── WEB-INF │ └── web.xml └── z.properties
Note: If you are using the Eclipse IDE and have installed the eclipsoid plugin (How_to_install_Eclipsoid) you can use the wizard at "File > New > Other > New Java/Web z2-Project".
Updated by Henning Blohm almost 4 years ago · 5 revisions