-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Java Installation Guide for Linux #93
Changes from 5 commits
188b55a
fa2c4df
6770c3e
41679e6
12c4796
8cb899b
c5789da
7896990
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
{% set title="Java 17 Installation Guide for Linux Users" %} | ||
<frontmatter> | ||
title: "{{ title }}" | ||
pageNav: 2 | ||
</frontmatter> | ||
|
||
# {{ title }} | ||
|
||
This guide explains how to install the **==[OpenJDK Java 17](https://openjdk-sources.osci.io/openjdk17/)==** on Linux using the command line. This guide was created using Ubuntu 22.04 but the steps for other Debian based Linux distros should be similar. | ||
|
||
|
||
## Installation | ||
This should be the default option for users with admin access to their system. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since this is worded as the default option, are there other options for users (both with admin access as well as maybe those without)? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @mfjkri it is possible to install java without admin access, but I felt that putting that option in the guide would be confusing for new users, so I omitted it. I wanted to emphasis here that these steps require extra privileges. Maybe a better way to phrase this would be to replace the whole line with "This guide assumes you have super user access."? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for the explanation! I agree, mentioning non-admin installations can complicate things for new users. The revised wording should work well. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @mfjkri great, I've included both this and the link change in the latest few commits |
||
|
||
* **Update APT repositories** {{ step_numbers }} | ||
* First we need to ensure our apt repositories are updated. Enter the following command in your terminal: | ||
```bash | ||
sudo apt update && sudo apt upgrade | ||
``` | ||
Enter your password if prompted. | ||
* **Install JDK** | ||
* Install the Java 17 OpenJDK version by running: | ||
```bash | ||
sudo apt install openjdk-17-jdk | ||
``` | ||
Note that the default installation location is usually `/usr/lib/jvm/`. | ||
* **Verify Installation** | ||
* To verify the installation, run: | ||
```bash | ||
java -version | ||
``` | ||
|
||
<!-- ======================================================================= --> | ||
|
||
## Switching between Java versions | ||
|
||
If you have multiple versions of Java installed, you can switch between them using `update-alternatives`. | ||
|
||
* **To see the currently active Java version** run, | ||
```bash | ||
java -version | ||
``` | ||
* **To switch to a different installed version**, run the following command. | ||
```bash | ||
sudo update-alternatives --config java | ||
``` | ||
You should see terminal output like this: | ||
<img src="images/javaInstallationLinux/update_alternatives_java.png" style="padding: 10px;"> | ||
|
||
Follow the instructions to change to your desired version. | ||
For example, to use Java 11 in the image above, type `1` into the terminal. | ||
* **If you don't have the desired version installed**, you can search for it by running the following command: | ||
```bash | ||
sudo apt-cache search openjdk | grep "\-jdk" | ||
``` | ||
You should see the available OpenJDK Java versions listed like so: | ||
<img src="images/javaInstallationLinux/list_openjdk_versions.png" style="padding: 10px;"> | ||
|
||
Decide on one of the available versions and follow the same steps as above to install your desired Java version. | ||
|
||
-------------------------------------------------------------------------------- | ||
|
||
**Authors:** | ||
* Initial Version: Drustan Yeo ([@drustanyjt](https://github.com/drustanyjt)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Related to #96, this should not include the prefix
tutorials/
as it is already included in the Java Installation Guides URL (I believe this change is not yet inmaster
however).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mfjkri Thanks for pointing this out! I'll modify this accordingly for line 11 only (I think lines 9 and 10 should be updated when I sync from master).