Skip to content

Commit 4faf48d

Browse files
authored
Merge pull request #1195 from jasonrandrews/review
Add Java install guide and a Java page to the migration Learning Path
2 parents 3a93333 + edc1050 commit 4faf48d

File tree

4 files changed

+500
-2
lines changed

4 files changed

+500
-2
lines changed

content/install-guides/java.md

Lines changed: 327 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,327 @@
1+
---
2+
title: Java
3+
author_primary: Jason Andrews
4+
minutes_to_complete: 15
5+
official_docs: https://docs.oracle.com/en/java/
6+
7+
additional_search_terms:
8+
- linux
9+
- cloud
10+
11+
multi_install: false
12+
multitool_install_part: false
13+
14+
test_images:
15+
- ubuntu:latest
16+
test_maintenance: false
17+
18+
tool_install: true
19+
weight: 1
20+
layout: installtoolsall
21+
---
22+
23+
Java is a high-level, object-oriented programming language first released by Sun Microsystems in 1995.
24+
25+
It is designed to have as few implementation dependencies as possible, making it a versatile and widely-used language.
26+
27+
## Is Java available for Arm Linux?
28+
29+
Yes, there are numerous ways to install Java on Arm Linux distributions.
30+
31+
Below are some of the common methods to install Java. This includes both the Java runtime environment (JRE), which is used to run Java applications and the Java development kit (JDK) which is used to create Java applications.
32+
33+
Pick the one that works best for you.
34+
35+
## Install Java using the Linux package manager
36+
37+
For distributions using `apt` - including Debian and Ubuntu:
38+
39+
```console
40+
sudo apt update
41+
sudo apt install default-jre -y
42+
sudo apt install default-jdk -y
43+
```
44+
45+
For distributions using `dnf` - including Fedora and Red Hat:
46+
47+
```console
48+
sudo dnf install java-latest-openjdk
49+
```
50+
51+
For distributions using `pacman` - including Arch and Manjaro:
52+
53+
```console
54+
sudo pacman -S jdk-openjdk
55+
sudo pacman -S jre-openjdk
56+
```
57+
58+
## Install Java using Amazon Corretto
59+
60+
Amazon Corretto is a no-cost distribution of the Open Java Development Kit (OpenJDK). It is maintained and supported by Amazon Web Services (AWS).
61+
62+
You can install Corretto using `apt` with the commands:
63+
64+
```console
65+
wget -O - https://apt.corretto.aws/corretto.key | sudo gpg --dearmor -o /usr/share/keyrings/corretto-keyring.gpg && \
66+
echo "deb [signed-by=/usr/share/keyrings/corretto-keyring.gpg] https://apt.corretto.aws stable main" | sudo tee /etc/apt/sources.list.d/corretto.list
67+
sudo apt-get update; sudo apt-get install -y java-21-amazon-corretto-jdk
68+
```
69+
70+
More installation options for Corretto are available in the [Amazon Corretto 21 Guide for Linux](https://docs.aws.amazon.com/corretto/latest/corretto-21-ug/linux-info.html)
71+
72+
## Install Java using Snap
73+
74+
For Linux distributions with `snap` you can install Java using:
75+
76+
```console
77+
sudo snap install openjdk
78+
```
79+
80+
## Is there a way to install Java from the official website?
81+
82+
You can download Java from the [Oracle website](https://www.oracle.com/java/technologies/javase-downloads.html) and install it manually. Look for the files with ARM64 in the description.
83+
84+
Download a [tar.gz](https://download.oracle.com/java/22/latest/jdk-22_linux-aarch64_bin.tar.gz) file from the website.
85+
86+
Extract the contents of the file:
87+
88+
```console
89+
tar xvf jdk-22_linux-aarch64_bin.tar.gz
90+
```
91+
92+
Move the contents to a directory of your choice:
93+
94+
```console
95+
sudo mv jdk-22.0.2 /usr/local/
96+
```
97+
98+
Set up environment variables to locate your installation:
99+
100+
```console
101+
export JAVA_HOME=/usr/local/jdk-22.0.2
102+
export PATH=$JAVA_HOME/bin:$PATH
103+
```
104+
105+
Add the environment variables to your `~/.bashrc` file to set them permanently.
106+
107+
## Can I change the default Java version if multiple versions are installed?
108+
109+
Yes, you can change the default version. For systems with `apt` use:
110+
111+
```console
112+
sudo update-alternatives --config java
113+
```
114+
115+
You will be given the option to select a new version. The options are depend on the software currently installed on your computer.
116+
117+
```output
118+
There are 3 choices for the alternative java (providing /usr/bin/java).
119+
120+
Selection Path Priority Status
121+
------------------------------------------------------------
122+
* 0 /usr/lib/jvm/java-21-amazon-corretto/bin/java 12100004 auto mode
123+
1 /usr/lib/jvm/java-17-openjdk-arm64/bin/java 1711 manual mode
124+
2 /usr/lib/jvm/java-21-amazon-corretto/bin/java 12100004 manual mode
125+
3 /usr/lib/jvm/java-21-openjdk-arm64/bin/java 2111 manual mode
126+
127+
Press <enter> to keep the current choice[*], or type selection number:
128+
```
129+
130+
For this case, if you select option 1, Java 17 becomes the default.
131+
132+
## How do I print the Java version?
133+
134+
Print the version of the Java runtime:
135+
136+
```console
137+
java -version
138+
```
139+
140+
The output will be similar to:
141+
142+
```output
143+
openjdk version "21.0.4" 2024-07-16
144+
OpenJDK Runtime Environment (build 21.0.4+7-Ubuntu-1ubuntu224.04)
145+
OpenJDK 64-Bit Server VM (build 21.0.4+7-Ubuntu-1ubuntu224.04, mixed mode, sharing)
146+
```
147+
148+
Print the version of the Java compiler:
149+
150+
```console
151+
javac -version
152+
```
153+
154+
The output will be similar to:
155+
156+
```output
157+
javac 21.0.4
158+
```
159+
160+
## Which version of Java should I use for Arm Linux systems?
161+
162+
It’s important to ensure that your version of Java is at least 11.0.9. There are large performance improvements starting from version 11.0.9. Since then, Java performance has steadily increased over time and newer versions will provide better performance.
163+
164+
## Which flags are available for tuning the JVM?
165+
166+
The Java virtual machine (JVM) includes a number of flags which are available to tune performance and aid in debugging. Some of the flags are general purpose and some are Arm architecture specific.
167+
168+
To print the final values of the flags after the JVM has been initialized run:
169+
170+
```console
171+
java -XX:+PrintFlagsFinal -version
172+
```
173+
174+
## Are there other tools commonly used in Java projects?
175+
176+
There are a number of Java related tools you may want to install.
177+
178+
### Apache Maven
179+
180+
Apache Maven is a powerful build automation tool primarily used for Java projects.
181+
182+
It simplifies the build process by providing a uniform build system, dependency management, and project management capabilities.
183+
184+
You can install it from the `apt` package manager:
185+
186+
```console
187+
sudo apt-get install -y maven
188+
```
189+
190+
Print the version:
191+
192+
```console
193+
mvn -v
194+
```
195+
196+
The output is similar to:
197+
198+
```output
199+
Apache Maven 3.8.7
200+
Maven home: /usr/share/maven
201+
Java version: 22.0.2, vendor: Oracle Corporation, runtime: /usr/local/jdk-22.0.2
202+
Default locale: en, platform encoding: UTF-8
203+
OS name: "linux", version: "6.8.0-41-generic", arch: "aarch64", family: "unix"
204+
```
205+
206+
### Gradle
207+
208+
Gradle is another build automation tool that is widely used for Java projects.
209+
210+
It is designed to be highly customizable and flexible, making it suitable for a wide range of projects.
211+
212+
You can install it from the `apt` package manager:
213+
214+
```console
215+
sudo apt install gradle -y
216+
```
217+
218+
You can also install specific versions by downloading and extracting a zip file:
219+
220+
```console
221+
wget https://services.gradle.org/distributions/gradle-8.10-bin.zip -O gradle-8.10-bin.zip
222+
unzip gradle-8.10-bin.zip
223+
sudo mv gradle-8.10 /opt/gradle
224+
sudo ln -s /opt/gradle/bin/gradle /usr/local/bin/gradle
225+
```
226+
227+
Print the version:
228+
229+
```console
230+
gradle -v
231+
```
232+
233+
The output is similar to:
234+
235+
```output
236+
Welcome to Gradle 8.10!
237+
238+
Here are the highlights of this release:
239+
- Support for Java 23
240+
- Faster configuration cache
241+
- Better configuration cache reports
242+
243+
For more details see https://docs.gradle.org/8.10/release-notes.html
244+
245+
246+
------------------------------------------------------------
247+
Gradle 8.10
248+
------------------------------------------------------------
249+
250+
Build time: 2024-08-14 11:07:45 UTC
251+
Revision: fef2edbed8af1022cefaf44d4c0514c5f89d7b78
252+
253+
Kotlin: 1.9.24
254+
Groovy: 3.0.22
255+
Ant: Apache Ant(TM) version 1.10.14 compiled on August 16 2023
256+
Launcher JVM: 22.0.2 (Oracle Corporation 22.0.2+9-70)
257+
Daemon JVM: /usr/local/jdk-22.0.2 (no JDK specified, using current Java home)
258+
OS: Linux 6.8.0-41-generic aarch64
259+
```
260+
261+
### Apache Ant
262+
263+
Apache Ant is a Java-based build tool used to automate the build process for Java projects. It is similar to Make but is designed specifically for Java projects.
264+
265+
Ant uses XML to describe the build process and dependencies.
266+
267+
You can install it from the `apt` package manager:
268+
269+
```console
270+
sudo apt install ant -y
271+
```
272+
273+
You can also install specific versions by downloading and extracting a zip file:
274+
275+
```console
276+
wget https://downloads.apache.org/ant/binaries/apache-ant-1.10.13-bin.zip -O apache-ant-1.10.13-bin.zip
277+
unzip apache-ant-1.10.13-bin.zip
278+
sudo mv apache-ant-1.10.13 /opt/ant
279+
sudo ln -s /opt/ant/bin/ant /usr/local/bin/ant
280+
```
281+
282+
Print the version:
283+
284+
```console
285+
ant -version
286+
```
287+
288+
The output is similar to:
289+
290+
```output
291+
Apache Ant(TM) version 1.10.13 compiled on January 4 2023
292+
```
293+
294+
### Apache JMeter
295+
296+
JMeter is an open-source tool designed for performance and load testing Java applications.
297+
298+
You can install it using:
299+
300+
```console
301+
wget https://downloads.apache.org/jmeter/binaries/apache-jmeter-5.6.3.tgz
302+
tar xzf apache-jmeter-5.6.3.tgz
303+
sudo mv apache-jmeter-5.6.3 /opt/jmeter
304+
sudo ln -s /opt/jmeter/bin/jmeter /usr/local/bin/jmeter
305+
```
306+
307+
Print the version:
308+
309+
```console
310+
jmeter --version
311+
```
312+
313+
The output is similar to:
314+
315+
```output
316+
Aug 27, 2024 9:01:58 PM java.util.prefs.FileSystemPreferences$1 run
317+
INFO: Created user preferences directory.
318+
_ ____ _ ____ _ _ _____ _ __ __ _____ _____ _____ ____
319+
/ \ | _ \ / \ / ___| | | | ____| | | \/ | ____|_ _| ____| _ \
320+
/ _ \ | |_) / _ \| | | |_| | _| _ | | |\/| | _| | | | _| | |_) |
321+
/ ___ \| __/ ___ \ |___| _ | |___ | |_| | | | | |___ | | | |___| _ <
322+
/_/ \_\_| /_/ \_\____|_| |_|_____| \___/|_| |_|_____| |_| |_____|_| \_\ 5.6.3
323+
324+
Copyright (c) 1999-2024 The Apache Software Foundation
325+
```
326+
327+
You are ready to use Java on your Arm Linux system.

content/learning-paths/servers-and-cloud-computing/migration/golang.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# User change
33
title: "Migrating Go applications"
44

5-
weight: 4
5+
weight: 5
66

77
layout: "learningpathall"
88

content/learning-paths/servers-and-cloud-computing/migration/isv.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# User change
33
title: "List of software products supporting Arm"
44

5-
weight: 5
5+
weight: 6
66

77
layout: "learningpathall"
88
---

0 commit comments

Comments
 (0)