Skip to content

Commit

Permalink
WMS ID 7881: AJ-20724 JMS 9.0 brown button changes (#328)
Browse files Browse the repository at this point in the history
AJ-20724 JMS 9.0 brown button changes
  • Loading branch information
tchoo-oracle authored Aug 22, 2024
1 parent 6d08eb2 commit f6715a8
Show file tree
Hide file tree
Showing 62 changed files with 168 additions and 388 deletions.
129 changes: 45 additions & 84 deletions java-management/create-a-java-application/create-a-java-application.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ Estimated Time: 10 minutes

In this workshop, you will:

* Create a Compute Instance
* Create a Oracle Linux Compute Instance on OCI
* Install Java on Compute Instance
* Create a simple Java application

### Prerequisites

* You have signed up for an account with Oracle Cloud Infrastructure and have received your sign-in credentials.
* You are using an Oracle Linux image on your Managed Instance for this workshop.
* You are using an Oracle Linux image for your Managed Instance for this workshop.
* Access to the cloud environment and resources configured in the previous workshop

## Task 1: Create a Compute Instance
Expand Down Expand Up @@ -76,20 +76,18 @@ In this workshop, you will:
* **Memory (GB)**: 1
* **Network bandwidth (Gbps)**: 0.48

> **Note:** Usage of Ampere shapes is not recommended for Java Management Service as they are not supported.
![image of image and shape for the Compute Instance](images/instance-image-and-shape.png)

Click **Edit** to review the **Networking** settings.
Click **Edit** to review the **Networking** settings.

Review the **Networking** settings by clicking **Edit** at the **Primary VNIC information**.
Review the **Networking** settings by clicking **Edit** at the **Primary VNIC information**.

![image of networking setting](images/instance-networking.png)

If there are no VCNs available, click **Create new virtual cloud network**.

![image of networking settings with no vcns available](images/instance-vcn-create.png)

Take the default values provided by the wizard.

**Virtual cloud network**: vcn-'date'-'time'
Expand Down Expand Up @@ -123,7 +121,7 @@ In this workshop, you will:

5. You have successfully created an Oracle Linux instance.

## Task 2: Access Instance via SSH
## Task 2: Access and setup your Instance via SSH

1. Open the navigation menu and click **Compute**. Under **Compute**, click **Instances**.

Expand Down Expand Up @@ -155,77 +153,49 @@ ssh -i <path-to-private-key/your-private-key-file> opc@<x.x.x.x>

6. You should be able to login to your instance now.

## Task 3: Install Java 8 and create a simple Java application

### For **Linux**

1. Install Oracle JDK 8 (64-bit) using `yum`.
```
<copy>
sudo yum -y install jdk-1.8-headful.x86_64
</copy>
```
> **Note:** Management Agents require JDK 8 and superuser privileges for installation.
> **NOTE:** The following steps are required if you have created an Always Free-eligible compute with 1 OCPU and 1 GB memory
To check the installed Java version, you can check using `-version`.
```
<copy>
java -version
</copy>
```
7. The memory allocated for Always Free-eligible computes is insufficient for this workshop. The next few steps increases the swapsize to handle this limitation.

2. Build your Java application.
8. Switch to the root user.

In the **Terminal** window, create a Java file by entering this command:
```
<copy>
nano HelloWorld.java
</copy>
```
```
<copy>
sudo su
</copy>
```

In the file, paste the following text:
9. Execute the following command as sudo to increase the default swapsize.

```
<copy>
public class HelloWorld {
public static void main(String[] args) throws InterruptedException{
System.out.println("This is my first program in java");
int number=15;
System.out.println("List of even numbers from 1 to "+number+": ");
for (int i=1; i<=number; i++) {
//logic to check if the number is even or not
//if i%2 is equal to zero, the number is even
if (i%2==0) {
System.out.println(i);
Thread.sleep(2000);
}
}
}//End of main
}//End of HelloWorld Class
</copy>
```
```
<copy>
swapoff -a && rm -f /.swapfile && fallocate -l 4G /.swapfile && mkswap /.swapfile && chmod 600 /.swapfile && swapon -a
</copy>
```

3. To save the file, type **CTRL+x**. Before exiting, nano will ask you if you want to save the file: Type **y** and **Enter** to save and exit.
10. You should see the following output.

### For **Windows**
![image of swapsize being updated](images/instance-changeswapfile.png)

1. Install Oracle JDK 8 in your instance. Download the x64 installer `jdk-8u<VERSION>-windows-x64.exe` from the [Java download](https://www.oracle.com/java/technologies/downloads/#java8-windows) page. Please note that you need an **Oracle Account** in order to download the software.
11. It is also highly recommended to update your oracle cloud agent for your OCI compute instance.

Run the downloaded file and follow the instruction of installer. Leave default options, take note of the jdk installation path.
```
<copy>
dnf update -y oracle-cloud-agent
</copy>
```

Set environment variables on your system: Right-click on **My Computer** -> **Properties** -> **Advanced system settings** (on the top-left) -> **Environment Variables…** button on the bottom -> double-click on **Path** of **System variables** part of form. -> **New**-> paste paths for jdk and jre **bin** folder (for example: C:\Program Files\Java\jdk1.8.0\_161\bin; C:\Program Files\Java\jre1.8.0\_161\bin).
## Task 3: Install Java and create a simple Java application on your Compute Instance

Set the **JAVA\_HOME** environment variable. To set it, go to **System variables** form -> click **New** -> enter **JAVA\_HOME** for **Variable name:** and **path/to/jdk** for **Variable value:** (for example: C:\Program Files\Java\jdk1.8.0_161).
1. Install Oracle JDK 17 using dnf

To check if Java has been installed, in **Command Prompt** window, enter the following command. Make sure to open a new Command Prompt as the recent changes in environment variables may not be reflected in previous Command Prompt winodws.
```
<copy>
javac -help
sudo dnf -y install jdk-17
</copy>
```
There should be a list of options. Now, enter the following:
To check the installed Java version, you can check using `-version`.
```
<copy>
java -version
Expand All @@ -234,49 +204,40 @@ ssh -i <path-to-private-key/your-private-key-file> opc@<x.x.x.x>
2. Build your Java application.
In the **Command Prompt** window, create a java file by entering this command:
In the **Terminal** window, create a Java file by entering this command:
```
<copy>
notepad HelloWorld.java
nano HelloWorld.java
</copy>
```
In the file, paste the following text:
```
<copy>
public class HelloWorld {
public static void main(String[] args) throws InterruptedException{
System.out.println("This is my first program in java");
int number=15;
System.out.println("List of even numbers from 1 to "+number+": ");
for (int i=1; i<=number; i++) {
//logic to check if the number is even or not
//if i%2 is equal to zero, the number is even
int number=15;
System.out.println("List of even numbers from 1 to "+number+": ");
for (int i=1; i<=number; i++) {
//logic to check if the number is even or not
//if i%2 is equal to zero, the number is even
if (i%2==0) {
System.out.println(i);
Thread.sleep(2000);
}
}
}
}//End of main
}//End of HelloWorld Class
</copy>
```
3. Go to the File option and click the Save button to save the file. Close the notepad window. Move to the command prompt window again.
> **Note:** To conserve resources and reduce charges, remember to stop your compute instance after completing the task.
3. To save the file, type **CTRL+x**. Before exiting, nano will ask you if you want to save the file: Type **y** and **Enter** to save and exit.
You may now **proceed to the next lab.**
## Troubleshoot Java application creation issues
**For Task 3**
* If you encounter an error similar to the following:
```
No match for argument: jdk1.8.x86_64
```
Use a new instance with AMD or Intel shape instead of Ampere.
## Learn More
* Use the [Troubleshooting](https://docs.oracle.com/en-us/iaas/jms/doc/troubleshooting.html#GUID-2D613C72-10F3-4905-A306-4F2673FB1CD3) chapter for explanations on how to diagnose and resolve common problems encountered when installing or using Java Management Service.
Expand All @@ -287,4 +248,4 @@ You may now **proceed to the next lab.**
## Acknowledgements
* **Author** - Esther Neoh, Java Management Service
* **Last Updated By** - Chan Wei Quan, October 2023
* **Last Updated By** - Teck Kian Choo, August 2024
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified java-management/set-up-oci-for-jms/images/jms-topology.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified java-management/set-up-oci-for-jms/images/new-jms-policy.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 5 additions & 5 deletions java-management/set-up-oci-for-jms/set-up-oci-for-jms.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ The Onboarding Wizard helps to create the necessary resources automatically. We
* In the Oracle Cloud Console, open the navigation menu and click **Identity & Security**. Under **Identity**, click **Policies**.
![image of console navigation to policies](images/console-navigation-policies.png)
&nbsp;
* Confirm the creation of new policy labeled `JMS_Policy`.
* Confirm the creation of new policy labeled `JMS_Policy_Fleet_Compartment`.
![image of new jms policy](images/new-jms-policy.png)

You may now **proceed to the next lab**.
Expand Down Expand Up @@ -240,7 +240,7 @@ Sign in to the Oracle Cloud Console as an administrator using the credentials pr
* Click **Create Policy**.
![image of policies main page](images/policies-main-page.png)
&nbsp;
* In the Create Policy dialog box, enter a name for the policy (for example, `JMS_Policy`), and a description.
* In the Create Policy dialog box, enter a name for the policy (for example, `JMS_Policy_Fleet_Compartment`), and a description.
&nbsp;
* Select the root compartment for your tenancy from the drop-down list.
&nbsp;
Expand All @@ -260,13 +260,13 @@ Sign in to the Oracle Cloud Console as an administrator using the credentials pr
ALLOW GROUP FLEET_MANAGERS TO MANAGE jms-plugins IN COMPARTMENT Fleet_Compartment
ALLOW DYNAMIC-GROUP JMS_DYNAMIC_GROUP TO USE METRICS IN COMPARTMENT Fleet_Compartment
ALLOW DYNAMIC-GROUP JMS_DYNAMIC_GROUP TO MANAGE management-agents IN COMPARTMENT Fleet_Compartment
ALLOW DYNAMIC-GROUP JMS_DYNAMIC_GROUP TO MANAGE management-agents IN COMPARTMENT Fleet_Compartment
ALLOW DYNAMIC-GROUP JMS_DYNAMIC_GROUP TO MANAGE log-content IN COMPARTMENT Fleet_Compartment
ALLOW DYNAMIC-GROUP JMS_DYNAMIC_GROUP TO MANAGE instances IN COMPARTMENT <instance_compartment>
ALLOW DYNAMIC-GROUP JMS_DYNAMIC_GROUP TO MANAGE metrics IN COMPARTMENT Fleet_Compartment WHERE target.metrics.namespace='java_management_service'
ALLOW DYNAMIC-GROUP JMS_DYNAMIC_GROUP TO MANAGE jms-plugins IN COMPARTMENT Fleet_Compartment
ALLOW resource jms SERVER-COMPONENTS TO MANAGE metrics IN COMPARTMENT Fleet_Compartment WHERE target.metrics.namespace='java_management_service'
ALLOW resource jms SERVER-COMPONENTS TO MANAGE metrics IN COMPARTMENT Fleet_Compartment WHERE target.metrics.namespace='java_management_service'
ALLOW resource jms SERVER-COMPONENTS TO USE management-agent-install-keys IN COMPARTMENT Fleet_Compartment
ALLOW resource jms SERVER-COMPONENTS TO MANAGE log-groups IN COMPARTMENT Fleet_Compartment
ALLOW resource jms SERVER-COMPONENTS TO MANAGE log-content IN COMPARTMENT Fleet_Compartment
Expand Down Expand Up @@ -298,4 +298,4 @@ You may now **proceed to the next lab**.
## Acknowledgements
* **Author** - Alvin Lam, Java Management Service
* **Last Updated By/Date** - Son Truong, August 2024
* **Last Updated By/Date** - Teck Kian Choo, August 2024
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Loading

0 comments on commit f6715a8

Please sign in to comment.