Connect with us

Linux

How to Install and Configure Java on Ubuntu 20.04

Published

on

How to Install and Configure Java on Ubuntu 20.04

Java is one of the most popular programming languages ​​used to build various types of applications and systems. Java runs on all operating systems and devices. We can find applications developed in Java on your laptop, mobile phone, and game console.

In this guide, we will learn how to install Java on Ubuntu 20.04.

Before starting

There are several different Java implementations. OpenJDK and Oracle Java are the two main implementations of Java, with almost no difference between them except that Oracle Java has some additional commercial features. The Oracle Java license only permits non-commercial use of the software, such as personal use and development use.

The default Ubuntu 20.04 repository includes two OpenJDK packages, the Java Runtime Environment (JRE) and the Java Development Kit (JDK). The JRE consists of the Java virtual machine (JVM), classes, and binaries that make it possible to run Java programs. The JDK includes the JRE and the development/debugging tools and libraries needed to build Java applications.

If you are not sure which Java package to install, the general recommendation is to install the default version of Java, which is the OpenJDK version (JDK 11). Some Java-based applications may require a specific Java version, so as a user, it is mandatory to read the application documentation.

Install Java OpenJDK 11 on Ubuntu 20.04

At the time of writing, Java 11 is a long-term supported (LTS) version of Java. It is also the default Java development and runtime in Ubuntu 20.04.

Run the following command as a user with Sudo or root privileges to update the packages index and install the OpenJDK 11 packages:

sudo apt update
sudo apt install openjdk-11-jdk

The JRE is included in the JDK package. If you only need the JRE, install the OpenJDK-11-JRE. For minimal Java runtime, install the OpenJDK-11-JDK-headless.

Once the installation is complete, verify by checking the Java version:

java -version

The output will look like this:

openjdk version "11.0.7" 2020-04-14
OpenJDK Runtime Environment (build 11.0.7+10-post-Ubuntu-3ubuntu1)
OpenJDK 64-Bit Server VM (build 11.0.7+10-post-Ubuntu-3ubuntu1, mixed mode, sharing)

At this point, the Java installation on the Ubuntu system has been successful.

Install Java OpenJDK 8 on Ubuntu 20.04

Java 8, the earlier LTS version of Java, is still widely used. If your application is running on Java 8, you can install it by typing the following command:

sudo apt update
sudo apt install openjdk-8-jdk

Verify the installation by checking the Java version:

java -version

The output will look like this:

openjdk version "1.8.0_252"
OpenJDK Runtime Environment (build 1.8.0_252-8u252-b09-1ubuntu1-b09)
OpenJDK 64-Bit Server VM (build 25.252-b09, mixed mode)

Set Default Java Version on Ubuntu 20.04


If you have multiple versions of Java installed on the system, To check the default Java version, you can use the following command:

java- Version

To be able to change the standard version, use the tools update-alternatives as shown below:

sudo update-alternatives --config java

The output will look like the following

There are 2 choices for the alternative java (providing /usr/bin/java).

  Selection Path Priority Status
-------------------------------------------------- ----------
* 0 /usr/lib/jvm/java-11-openjdk-amd64/bin/java 1111 auto mode
  1 /usr/lib/jvm/java-11-openjdk-amd64/bin/java 1111 manual mode
  2 /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java 1081 manual mode

Press <enter> to keep the current choice[*], or type selection number: 

You will be presented with a list of all installed Java versions. Enter the version number you want to use as the default and press Enter.

Set JAVA_HOME Environment Variable

Some applications written in Java use environment variables JAVA_HOMEto specifies the Java installation location.

To set the JAVA_HOME environment variable, use the command update-alternatives to find where Java is installed:

sudo update-alternatives --config java

In our case, the installation path is as follows:

  • OpenJDK 11 is located at /usr/lib/jvm/java-11-openjdk-amd64/bin/java
  • OpenJDK 8 is located at /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java

Copy the installation path of the installation of your choice. Next, open the file /etc/environment :

sudo nano /etc/environment

Add the following line, at the end of the file:

/etc/environment
JAVA_HOME="/usr/lib/jvm/java-11-openjdk-amd64"

Make sure to replace the path with the path to your Java version of choice.

You can log out and then log back in, or run the following source command to apply the changes to the current session:

sources /etc/environment

To verify that the environment variables are JAVA_HOMEset correctly, run the following echo command:

echo $JAVA_HOME
/usr/lib/jvm/java-11-openjdk-amd64

/etc/environment is the system configuration file, which is used by all users. If you want to set variables JAVA_HOMEon on a per user basis, add a line to .bashrcor other configuration file that is loaded when the user logs in.

How to Uninstall Java on Ubuntu 20.04

If for some reason you want to uninstall a Java package, you can uninstall it like any other package installed with apt.

For example, if you want to remove a package default-JDK just run the command:

sudo apt remove openjdk-11-jdk

Conclusion

OpenJDK 11 and OpenJDK 8 are available in the default Ubuntu 20.04 repositories and can be installed using the apt package manager.

Advertisement

Linux

2 Easy Ways to Format Flashdisk on Ubuntu Linux, which method do you choose?

Published

on

How to Format Flashdisk on Linux Ubuntu

Flash format is an activity that aims to empty the files stored in it. This method is done for various reasons, such as wanting to copy new files, removing viruses, and others.

Flash format in Linux is not much different from the flash format in Windows, and it’s just that there are various ways of formatting that you can do. Depending on your understanding of which one is easy, you can use your method.

In this discussion, I will use two of the most common and easy-to-use ways to format a flash drive on Linux, namely how to format a flash drive manually and via the Terminal. The Type of Linux that I use here is the desktop version of Ubuntu 16.04.

How to Format Flashdisk on Linux Ubuntu

( I. ) Format Flash Disk Manually

The one most often used by users is how to format the flash here manually I use. The steps are as follows.

1. Open your file explorer or directory. Click on the flash drive that you want to format to see if your flash drive is legible, what it contains, and are you sure you want to format it.

2. After that, right-click on your flash device, as shown in the picture—Click Format to empty your flash.

3. Next, there are options ( Erase, Type, and Format ) that you can adjust to your needs on this Volume Format. You can follow the default options as shown in the picture.

2 Easy Ways to Format Flashdisk on Ubuntu Linux
  • I select ‘ Don’t overwrite existing data (Quick )’ in the Erase section. This option makes the formatting process faster.
  • I choose the FAT format for Type here, but you can select another such as NTFS.
  • Then, write a new name for your flash device in the Name field.
  • Next, click the Format button.

4. After that, a confirmation will appear again to make sure you do the correct format of the flash. At this stage, the Type of your flash device will be displayed as indicated by the arrow in the image. The flash that I formatted is branded HP and has a capacity of 16GB. Click the Format button to start the flash format process.

5. Format your flash drive has been successful. You can check it by re-opening your flash directory and seeing that the flash drive is empty.

( II. ) Format the flash drive via Terminal.

In addition to manually, you can format the flash via the Terminal. How to? Follow these steps.

1. First, you can check the contents of your flash drive first to make sure you format it. Here, the name of my flash is My FD.

2. Open your Terminal. You can use the shortcut by pressing the keyboard’s Ctrl + Alt + T keys. Type the command:

sudo fdisk -l

The above command aims to find out the address of your flash drive. In the command, use the word sudo, where the Terminal will ask for your password input first. Enter your password; then, the Terminal will display the specifications of the device installed on your computer.

The device that is connected is the flash that we will format. You can ensure the device is your flash drive by observing its size. The example image above says 15.1 G, which means that the flash that I will format is filled with 15.1 GB. Then, remember the address. The address is listed in the Device column, wherein the image above it says /dev/sdb1.

3. Next, use the flash address we know earlier to run the umount command. This command aims to release the flash that is currently associated. You can see the related flash disk in the file explorer, wherein the flash name has an arrow button, as shown below.

2 Easy Ways to Format Flashdisk on Ubuntu Linux, which method do you choose

Use the command below to remove your pen drive.

sudo umount /dev/sdb1

4. Next, you can type a command like the one below to format the flash drive.

sudo mkfs.vfat /dev/sdb1

There is the word ‘ vfat ‘ in the command where FAT states the flash format after formatting. You can replace it with NTFS, hfs, ext2, ext3, ext4, and others according to your needs.

5. Finally, your flash is successfully formatted. To check, please open your file explorer and prove your flash drive is empty.

Before formatting the flash drive, make sure there are no important files that will be deleted. Back up your precious data if you are worried about losing your files. That’s how to format the flash on Linux Ubuntu easily. Give your feedback in the comments column below. Thank you.

Continue Reading

Linux

How to Install Microsoft Teams on Linux

Published

on

How to Install Microsoft Teams on Linux

For those who don’t know, Microsoft Teams is now available as a Multi-Platform application on almost all operating systems, be it Windows, Mac, Linux, Android or iOS.

Now about this, we will summarize the short steps on how to Install Microsoft Teams on Linux. As usual, here, I will use Elementary OS as my mainstay Linux OS.

Here are the short steps.

Step 1. First, please open the Microsoft Teams site.

Step 2. Please download the Installer file from Microsoft Teams; please adjust it to the Linux distro you have, DEB for Ubuntu, Debian and all their descendants, and RPM for Fedora, CentOS and all their siblings.

Step 3. After the file is downloaded, please open the file, and if your Linux already has an app installer, the steps will be easier because we click install.

But if it doesn’t exist, we can use the classic steps by using Terminal. Open Terminal > Go to Directory Download > Then type the following command:

sudo dpkg -i <namafileinstaller>

Exactly as in the picture above, after typing the command, you need to enter your root password, and then the installation will run until the Microsoft Teams application is installed.

Well, please try, guys; it’s easy, isn’t it? I hope this article is useful.

Continue Reading

Linux

GParted, Partition Management Application for Linux Operating System

Published

on

GParted, Partition Management Application for Linux Operating System

Have you ever heard of GParted? This name may still sound less familiar to your ears, especially for those who use the Windows operating system because GParted is intended for Linux users.

Although it sounds less familiar, this application is quite a lot of people who use it. One of the reasons is because GParted offers ease of operation. Even people new to using it tend not to experience complicated problems even though it is the first time they try it.

What Are the Features of GParted?

What Are the Features of GParted

GParted is an application that can run on both x86 and x64 computers with operating systems such as Windows, Mac OS, and Linux with a minimum RAM size of 256 MB. From these specifications, we can know that this application is light because it only requires a RAM capacity of only 256 MB.

Some of the features that make GParted one we recommend include:

  • Create or delete partitions
  • Format partition
  • Resize partition
  • Mounting and unmounting partitions _
  • Label
  • Checking storage conditions
  • Enable and disable Swap (this feature can be used on devices with Linux OS)
  • New UUID
  • and others

You can use all of these features according to your needs. Using the features in GParted is not too difficult because the instructions are clear. Also, because GParted is GUI, it makes the instructions easy to understand.

How to Use GParted

  • As usual, you download the GParted application.
  • There will be an ISO file; then, you burn the file.
  • Restart the computer and make sure that the boot CD-ROM is in the first place
  • GParted is ready for you to use
  • You can click Resize or Move if you want to adjust the size of the hard disk.
  • You drag across the partition towards the left. Don’t forget to pay attention to the words New Size to create a new size and Free Space Following, the new partition you are using.
  • Then you press the Resize or Move button to start this process
  • You click the new partition in the Filesystem section. Then select ext3 and label ‘/.”
  • Click the Add button, then apply to begin the partition change process.
  • Restart the computer and see the size of the partition on the hard drive now
  • Don’t forget to backup your data first before using GParted.

For your information, several versions of the Linux operating system that can use GParted include Fedora, Ubuntu, Debian, and Open Suse. GParted stands for Gnome Partition Editor, an application with a GUI or Graphic User Interface.

This application is used for storage management, namely SSD or hard disk. Functions of GParted as found in the Partition Wizard in DLC Boot for Windows OS. At the beginning of its creation, this application was intended for Linux OS.

However, now you can download GParted and use it for Windows OS. By using this application, you can edit, resize, or create or delete partitions on the storage media on your computer or laptop.

Continue Reading
Advertisement

Latest

Who Invented Lithium ion Battery Who Invented Lithium ion Battery
Wiki1 month ago

Who Invented Lithium ion Batteries

SHARE More Imagine a world without smartphones, laptops, or electric cars. Crazy, right? These amazing devices rely on a powerful...

Who Invented SSD Who Invented SSD
Wiki1 month ago

Who Invented SSD : A Journey From Invention To Innovation

SHARE More The dominance of Solid State Drives (SSDs) in modern data storage is undeniable. Their lightning-fast performance, superior reliability,...

Google Gemini Google Gemini
Wiki2 months ago

Google Gemini: Your Super-Smart AI Sidekick (Made Easy!)

SHARE More Imagine a helpful friend who can write emails, translate languages, dream up creative ideas, and even write code!...

Who Invented Gorilla Glass Who Invented Gorilla Glass
Wiki2 months ago

Who Invented Gorilla Glass for Mobile: Unveiling the Inventor and Its Impact

SHARE More In the ever-evolving landscape of mobile technology, Gorilla Glass has emerged as a revolutionary material, providing durability and...

The Evolution of Touch Screen Technology A Journey into its Inventors and Innovations The Evolution of Touch Screen Technology A Journey into its Inventors and Innovations
Wiki2 months ago

The Evolution of Touch Screen Technology: A Journey into its Inventors and Innovations

SHARE More Touch screen technology has become an integral part of our daily lives, seamlessly blending with our smartphones, tablets,...

The Evolution of Memory Cards: Unraveling the Inventors Behind the Innovation The Evolution of Memory Cards: Unraveling the Inventors Behind the Innovation
Wiki2 months ago

The Evolution of Memory Cards: Unraveling the Inventors Behind the Innovation

SHARE More In the fast-paced world of technology, memory cards have become an indispensable part of our daily lives. From...

Who Invented Sim Card Who Invented Sim Card
Wiki3 months ago

Who Invented Sim Card | The Origin and Inventor of the SIM Card: A Revolutionary Communication Breakthrough

SHARE More In today’s digitally interconnected world, the SIM card stands as a tiny yet indispensable component of our daily...

Walkie-Talkies Walkie-Talkies
Wiki4 months ago

Who invented Walkie-Talkie | Exploring the Wonders of Walkie-Talkies: A Simple Guide for Beginners

SHARE More Walkie-talkies, often fondly referred to as “woki tokies,” are incredible communication devices that have stood the test of...

Who Invented Camera Lens Who Invented Camera Lens
Wiki4 months ago

Who Invented Camera Lens : A Revolutionary Innovation in Photography

SHARE More The invention of the camera lens stands as a pivotal milestone in the history of photography, fundamentally altering...

Who Invented Radio Who Invented Radio
Wiki5 months ago

The Evolution of Radio Broadcasting: Who Invented Radio?

SHARE More Radio broadcasting has been a cornerstone of communication, entertainment, and information dissemination for over a century. It revolutionized...

Trending

Share via
Copy link
Powered by Social Snap