I am developing an enterprise application using Jakarta EE (Java EE) in my business. Until now, I have learned and developed while reading reference books, but I did not have a document that suits me, from environment construction to development procedures, so I would like to summarize my knowledge so far in a serial format. ..
item | Contents |
---|---|
OpenJDK build | Azul Zulu 11 |
Framework | Jakarta EE 8 |
AP server | payara server 5.201 |
DB server | PostgreSQL 12 |
Build tool | Gradle 6.2.2 |
IDE | Eclipse 2020-03 (Pleiades All in One) |
OS | Windows 10 |
This time I will use Azul Zulu. Since payara server 5.192 supports Java 11, it is set to OpenJDK 11. https://jp.azul.com/downloads/zulu-community/?&architecture=x86-64-bit&package=jdk From the link above, click to download the Java 11 (LTS) Windows version of the msi.
Run the downloaded MSI file. Click Next, leave the installation folder at its default, and click Next.
Click Install to start the installation. When the installation is complete, the screen below will be displayed. Click Finish.
Then set the environment variables. Search for "environment variables" in the Windows settings and select "Edit system environment variables".
Click the environment variable.
Click New system environment variable.
Set the following system environment variables. Enter as shown in the table below and click OK.
Variable name | Variable value |
---|---|
JAVA_HOME | C:\Program Files\Zulu\zulu-11 |
Start the command prompt, execute "java -version", and if the following result is displayed, the installation is complete.
If you have another JDK installed, you may not get the above results. In that case, open the system environment variable settings and the beginning of Path is
\Program Files\Zulu\zulu-11\bin
Please change it to.
## PostgreSQL 12 installation
Use PostgreSQL as the database server.
https://www.enterprisedb.com/downloads/postgres-postgresql-downloads
Click Download for Windows x86-64 12.2 to download.
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/226889/f8d8bc26-41ee-1891-5352-c5a51368c59d.png)
Execute the downloaded exe file.
Click Next, leave the installation folder at its default, and click Next.
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/226889/14450907-10f1-4212-b1d8-2942378f8dea.png)
Leave the components at their defaults and click Next.
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/226889/1d8791bc-b090-1b80-da76-1a1555c0c0f1.png)
Specify the data storage destination. For development, use the default if you do not wish. Click Next.
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/226889/3f3b9913-dfd4-dfc9-5017-3cf5123dbba8.png)
Enter the password for the admin user "postgres". Click Next when you are done.
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/226889/894ae0e2-8f5d-5891-d1d9-b84fca57a900.png)
Set the connection port. Click Next with the defaults unless you have the number specified.
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/226889/520b7cbd-2227-86ed-c310-742ec593560a.png)
Set the locale. Select C and click Next.
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/226889/c8b3e9a9-a384-db3c-dd27-1532a5c402d4.png)
The Summary will be displayed. Click Next.
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/226889/95b5e49a-0952-6a03-dc6f-9043a88e4258.png)
Click Next to start the installation.
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/226889/e23df42d-bef0-a619-1d7f-d7efec7b6040.png)
When the installation is complete, the screen below will be displayed. Uncheck it and click Finish.
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/226889/c55aa256-7580-0963-a2fc-22ac1d8f621e.png)
This completes the PostgreSQL installation.
## payara server 5 installation
Use payara server as the Java EE application server.
https://www.payara.fish/software/downloads/all-downloads/
Install Full here.
Click Payara Server 5.201 (Full) Download to download the zip file.
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/226889/ef7dc835-84e2-eef9-1b5e-f67aed50ce7c.png)
Create a payara folder directly under the C drive, and create a payara-5.201 folder in it.
* 201 part is this version
Unzip the downloaded file and place the unzipped payara5 folder inside the payara-5.201 folder. The contents of the `C: \ payara \ payara-5.201 \ payara5` folder after placement will be as shown in the screen below.
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/226889/a4cb4f48-19e0-685d-f3c2-9c5285f0c58e.png)
Next, make the initial settings for payara server.
Start a command prompt and go to the `C: \ payara \ payara-5.201 \ payara5 \ bin` folder.
Start payara server.
Type ʻasadmin start-domain` to run it.
c:\payara\payara-5.201\payara5\bin>asadmin start-domain Waiting for domain1 to start ...................... Successfully started the domain : domain1 domain Location: C:\payara\payara-5.201\payara5\glassfish\domains\domain1 Log File: C:\payara\payara-5.201\payara5\glassfish\domains\domain1\logs\server.log Admin Port: 4848 Command start-domain executed successfully.
Log in as an administrator.
Type ʻasadmin login` to run it.
The login user is left blank because it is the default.
If you log in successfully, a `[user folder] \ .gfclient \ pass` file will be created.
* Binary file containing password information
c:\payara\payara-5.201\payara5\bin>asadmin login Enter admin user name [Enter to accept default]> Admin login information for host [localhost] and port [4848] is being overwritten with credentials provided. This is because the --savelogin option was used during create-domain command. Login information relevant to admin user name [admin] for host [localhost] and admin port [4848] stored at [C:\Users[User name].gfclient\pass] successfully. Make sure that this file remains protected. Information stored in this file will be used by administration commands to manage associated domain. Command login executed successfully.
Change the administrator password.
Type ʻasadmin change-admin-password` to run it.
The user name is blank because it is the default, and the password is not set, so proceed with the blank and enter the new password.
c:\payara\payara-5.201\payara5\bin>asadmin change-admin-password Enter admin user name [default: admin]>← Press Enter without typing anything Enter the admin password>← Press Enter without typing anything Enter the new admin password>← Enter the new password and press the Enter key Enter the new admin password again>← Enter the new password and press the Enter key Command change-admin-password executed successfully.
Log in as an administrator again.
Type ʻasadmin login` to run it.
The login user is left blank because it is the default, and the password is the new password you entered earlier.
After a successful login, the `[user folder] \ .gfclient \ pass` file will be updated.
c:\payara\payara-5.201\payara5\bin>asadmin login Enter admin user name [Enter to accept default]>← Press Enter without typing anything Enter admin password>← Enter the new password and press the Enter key Admin login information for host [localhost] and port [4848] is being overwritten with credentials provided. This is because the --savelogin option was used during create-domain command. Login information relevant to admin user name [admin] for host [localhost] and admin port [4848] stored at [C:\Users[User name].gfclient\pass] successfully. Make sure that this file remains protected. Information stored in this file will be used by administration commands to manage associated domain. Command login executed successfully.
Make the management console available.
Type ʻasadmin enable-secure-admin` to run it.
c:\payara\payara-5.201\payara5\bin>asadmin enable-secure-admin You must restart all running servers for the change in secure admin to take effect. Command enable-secure-admin executed successfully.
You will be prompted to restart, so restart payara server.
Type ʻasadmin restart-domain` to run it.
c:\payara\payara-5.201\payara5\bin>asadmin restart-domain Successfully restarted the domain Command restart-domain executed successfully.
Start a web browser, access `http: // localhost: 8080 /`, and check if the screen below is displayed.
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/226889/a0b61621-53cf-1720-6eb2-d6fdade064f9.png)
Go to `https: // localhost: 4848 /` and check if the login screen of the management console is displayed.
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/226889/1a572d4e-3690-c0d9-195b-1a4d1c5cbdef.png)
On the login screen, enter admin in User Name (upper) and the password you set earlier in Password (lower).
When you have successfully logged in and the screen below is displayed, the installation and initial settings of payara server are complete.
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/226889/fbde43e4-fd26-441e-d2d7-31782e161a51.png)
## Gradle installation
Download the latest version.
https://gradle.org/releases/
Click the v6.2.2 binary-only link at the bottom of the destination screen to download the zip file.
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/226889/0a156210-9778-e062-d869-71da04998a4c.png)
Create a gradle folder directly under the C drive.
Unzip the downloaded file and place the gradle-6.2.2 folder in the unzipped folder inside the gradle folder. The contents of the `c: \ gradle \ gradle-6.2.2` folder after placement will be as shown in the screen below.
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/226889/c305b83b-9073-503c-38c5-070d5785195a.png)
Set environment variables.
Search for "environment variables" in the Windows settings and select "Edit system environment variables".
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/226889/cf06c0dc-d8ed-d7be-56d8-2aab0f9a8907.png)
Click the environment variable.
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/226889/096a05e2-5a4c-ef6e-3e86-80a53ea8f83e.png)
Click New system environment variable.
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/226889/3b8bb232-93be-0564-eaa6-cc9829698687.png)
Set the following system environment variables.
Enter as shown in the table below and click OK.
|Variable name|Variable value|
|:---|:---|
| GRADLE_HOME| C:\gradle\gradle-6.2.2 |
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/226889/56223bab-7f0d-2b67-fc8a-df5d28655382.png)
Add the system environment variable Path.
Select Path and click Edit.
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/226889/8f88defa-7bd8-0e81-34f0-4e2db18aa581.png)
Click New, type% GRADLE_HOME% \ bin, and click OK.
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/226889/561270dc-4bba-8db8-dbe0-73887ed570bf.png)
After closing the environment variable edit screen, start the command prompt, execute "gradle -version", and if the following result is displayed, the installation is complete.
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/226889/afdbfec5-6505-a3df-d7b1-f8241ef97131.png)
## Eclipse installation / initial settings
This also installs the latest version. (I think Java Full Edition is good)
http://mergedoc.osdn.jp/
Unzip the downloaded zip file and place the pleiades folder directly under the C drive.
* Please use 7-zip to decompress.
Once deployed, double-click `c: \ pleiades \ eclipse \ eclipse.exe` to launch Eclipse.
After selecting the workspace and launching Eclipse, select Help> Eclipse Marketplace.
When the Eclipse Marketplace starts, type "payara tools" and press Enter to install payara tools from the search results.
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/226889/5eeb0271-7897-f84f-5d9c-1e9b97dcefe8.png)
If the following dialog is displayed, click Install.
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/226889/35f009c0-a459-fb43-3d81-d960a124b287.png)
After the installation is complete, restart Eclipse.
After the reboot is complete, open Window> Settings, select Server> Runtime Environment, and configure the development server settings.
Click Add.
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/226889/08fe23bf-9dc1-240a-e1ba-3c00ee6701d2.png)
Select Payara and click Next.
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/226889/d71f5311-0cb4-1974-9444-e2d8b28e1f6a.png)
Set the payara server installation folder to Payara Location, set the JDK installation folder to the Java location, and click Finish. Then click Apply and Close to close the settings dialog.
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/226889/a119c675-e893-667c-a5e5-0ed45c6eac6a.png)
Open the server view and click the link.
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/226889/12266816-6ce1-f283-fdad-297552f8f816.png)
Click Payara> Payara and click Next.
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/226889/ce761fc9-ce75-80ce-e4ea-a11e1c9ab935.png)
Enter your password and click Finish.
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/226889/d190dfb7-bd6e-54bf-07e1-c480ddbde26a.png)
Payara Server is added to the server view.
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/226889/e9a05bef-b482-cda8-28b1-0247dd95568f.png)
This completes the environment construction.
In the next chapter, you will create a project.
Recommended Posts