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

How to install XAMPP on Linux without complications

Published

on

How to install XAMPP on Linux without complications

Having a full web server locally can be tricky, but there is a package that makes this process easy: XAMPP. To get this feature on your system, see how to install XAMPP on Linux below.

XAMPP is a platform-independent server, which mainly consists of MySQL database, Apache web server, and interpreters for scripting languages: PHP and Perl.

The name XAMPP comes from the abbreviation of X (for any of the different operating systems), Apache, MySQL, PHP, Perl.

It acts as a free web server, is easy to use, and is capable of interpreting dynamic pages. Currently, XAMPP is available for Microsoft Windows, GNU/Linux, Solaris, and macOS X.

Find out which is the best NET promotion for you and receive incredible discounts. Check out!

For more details on how to configure and secure XAMPP, please visit this page.

Installing XAMPP on Linux

To install XAMPP on Linux, do the following:

Step 1. Open a terminal;
Step 2. Check if your system is 32-bit or 64-bit, for that, use the following command in the terminal:

     uname -m

Step 3. If you are using a 32-bit system, use the command below to download the program. If the link is out of date, go to this page and download the latest version and save it as xampp-installer.run:

    wget https://ufpr.dl.sourceforge.net/project/xampp/XAMPP%20Linux/7.4.11/xampp-linux-7.4.11-0-installer.run -O xampp-installer.run

Step 4. If you are using a 64-bit system, use the command below to download the program. If the link is out of date, go to this page and download the latest version and save it as xampp-installer.run:

    wget "https://sourceforge.net/projects/xampp/files/XAMPP%20Linux/7.4.22/xampp-linux-x64-7.4.22-0-installer.run/download" -O xampp-installer.run

or

    wget "https://sourceforge.net/projects/xampp/files/XAMPP%20Linux/8.0.9/xampp-linux-x64-8.0.9-0-installer.run/download" -O xampp-installer.run

Step 5. Make the file executable with the command below;

    chmod +x xampp-installer.run

Step 6. Start XAMPP installation, with the following command;

    sudo ./xampp-installer.run

Step 7. When it appears, follow the steps of the installation and configuration wizard:

How to install XAMPP on Linux without complications

Step 8. If your current graphical environment supports and is 32 bits, create a launcher for the program, executing the command below;

    echo -e '[Desktop Entry]\n Version=1.0\n Name=xampp\n Exec=gksudo /opt/lampp/manager-linux.run\n Icon=/opt/lampp/icons/world1.png\n Type=Application\n Categories=Application' | sudo tee /usr/share/applications/xampp.desktop

Step 9. If your current graphical environment supports and is 64 bits, create a launcher for the program, executing the command below;

   echo -e '[Desktop Entry]\n Version=1.0\n Name=xampp\n Exec=gksudo /opt/lampp/manager-linux-x64.run\n Icon=/opt/lampp/icons/world1.png\n Type=Application\n Categories=Application' | sudo tee /usr/share/applications/xampp.desktop

Step 10. For the shortcut to work correctly, install GKSU with the command below. If your distribution is not Debian-derived, look for the program in their package manager and install it;

sudo apt-get install gksu

Ready! Now, when you want to start the program, type sudo /opt/lampp/manager-linux.run(32-bit) or sudo /opt/lampp/manager-linux-x64.run(64-bit) or into a terminal, followed by the TAB key.

If your distribution supports it, put the shortcut on your desktop using the system file manager or the command below, and use it to start the program.

    sudo chmod +x /usr/share/applications/xampp.desktop
    cp /usr/share/applications/xampp.desktop  ~/Área\ de\ Trabalho/

If your system is in English, use this command to copy the shortcut to your desktop:

   cp /usr/share/applications/xampp.desktop ~/Desktop

For more details on this task, see this tutorial:
How to add application shortcuts to the Unity desktop
If you like, you can also use the system file manager to run the program, just by opening its folder and clicking on its executable.

Administering, verifying, and uninstalling XAMPP

To Administer, verify, and uninstall XAMPP on Linux, do the following:

Step 1. Open a terminal;
Step 2. If you want to start XAMPP through the terminal, use this command:

    sudo /opt/lampp/lampp start

Step 3. Or simply use the program’s graphical interface to start or stop the web server. To run it, use the shortcuts created, or simply type the command sudo /opt/lampp/manager-linux.runon 32-bit sudo /opt/lampp/manager-linux-x64.runsystems or , on 64-bit systems;

How to install XAMPP on Linux without complications

Step 4. To verify that the webserver is running, enter the following address into a browser:

    http://localhost

Step 5. If the installation worked, this page will appear:

How to install XAMPP on Linux without complications

Ready! You now have a web server on your system. But if you prefer LAMP, take a look at this tutorial:

Install LAMP on Linux and have a web server on your PC

Managing XAMPP via Terminal on Linux
To manage all XAMPP services via the terminal, do the following:

starting

To start all xampp services, use the following command in the terminal.

   sudo /opt/lampp/xampp start

To start Apache only, use:

sudo /opt/lampp/xampp startapache

To start just the Proftpd FTP server, use:

   sudo /opt/lampp/xampp startftp

To start the MySQL database server only:

   sudo /opt/lampp/xampp startmysql

stopping

To stop all xampp services, use the following command in the terminal.

   sudo /opt/lampp/xampp stop

To stop Apache only, use:

   sudo /opt/lampp/xampp stopapache

To stop only the Proftpd FTP server, use:

  sudo /opt/lampp/xampp stopftp

To stop just the MySQL database server:

  sudo /opt/lampp/xampp stopmysql

restarting

To restart all xampp services, use the following command in the terminal.

  sudo /opt/lampp/xampp restart

And for other commands, you can check the xampp help section by running the following.

  sudo /opt/lampp/xampp --help

How to remove XAMPP on Linux

If you need to uninstall XAMPP from your system, do the following:

Step 1. Open a terminal;
Step 2. Uninstall the program by executing the following commands;

sudo /opt/lampp/lampp stop
sudo /opt/lampp/uninstall
sudo rm -rf /opt/lampp

Continue Reading

Linux

Things To Do After Installing Ubuntu 16.04 LTS Xenial Xerus

Published

on

Things To Do After Installing Ubuntu 16.04 LTS Xenial Xerus

Perform System Updates & Upgrades


$ sudo apt update && sudo apt upgrade -y

Install Ubuntu Restricted Extras For Media Codec


$ sudo apt-get install ubuntu-restricted-extras

Add Canonical Partners in Software Repository


go to Software & Updates -> move to the Other Software tab -> check the Canonical Partners option, then enter the password -> Close -> Reload

Install GIMP (for image editing needs)


$ sudo apt install gimp -y

Install Uget (download manager)


$ sudo apt install uget -y

Install BleachBit (application to clean cache, cookies, temporary files, logs, junk, etc.)


$ sudo apt install bleachbit -y

Install Video Player Application (choose one)


$ sudo apt install vlc

$ sudo apt install smplayer

Install GDebi Package Manager


$ sudo apt install gdebi

Fix (afraid there will be a problem when updating and installing the above application)


$ sudo apt-get install -f

Automatically clean junk that your Linux doesn’t need


$ sudo apt clean

$ sudo apt autoremove

Reboot


$ reboot

Continue Reading

Linux

Learn Linux Commands For Beginner to Advanced

Published

on

Learn Linux Commands For Beginner to Advanced

INTRODUCTION

When you want to learn to deepen Linux, you will know the terms Command Line, Text Base, Terminal, or Shell, they are all the same and it will be discussed here in the future, I will call it Terminal or Linux commands.

Here we will learn basic commands that are often used in Linux so you will often use the keyboard and all commands must be typed such as creating folders, copying files, deleting files, and even installing applications using commands that must be typed and then there are still much more can be done using commands in Linux.

WHY NEED TO LEARN LINUX COMMANDS?

If you want to deepen Linux, you must master the Linux command/command line because by using the Linux command/command line, more features can be accessed and more power full because the Linux interface used to use the command line.

Although Linux already has a GUI/graphics, learning Linux Commands/command lines is very necessary if you want to deepen your learning of Linux, this is because GUI applications only provide limited functions and are only intended for laypeople, while administrator users or technicians need full control over Linux machines. , full Linux control can only be accessed via the Linux command/command-line interface either through the shell or terminal emulator.

WHAT IS THE LINUX COMMAND / LINUX COMMAND LINE

Basically, the Linux command is an application, it’s just that this application does not have a graphical display and only has a text-based display. by many people better known as the Linux command or Linux command.

LINUX COMMAND CASE SENSITIVE

when typing Linux commands make sure you use lowercase letters because all basic Linux commands use lowercase letters. The reason is that Linux is case sensitive where uppercase and lowercase letters are considered different, not only in typing commands but in file naming as well. Uppercase and lowercase letters are considered different so be careful when you create filenames.

AUTOCOMPLETE FEATURE ON LINUX TERMINAL

When you type a Linux command in a Linux terminal, you don’t have to write it down completely, you can take advantage of the auto-complete feature to speed up writing Linux commands on a Linux terminal. 2x then Linux will give suggestions/choices of Linux commands that you will use.

Learn Linux Commands For Beginner to Advanced

In the example above, I type apt then I press the TAB key 2x then Linux will suggest a list of Linux commands starting with apt, this auto-complete feature can also be used to remember commands that you forget to remember just by typing the first few characters of the command you made forget to remember.

Sometimes the autocomplete feature doesn’t run/work as it should.

HOW TO START LEARNING LINUX COMMANDS

To enter the terminal you need to open the terminal application in the menu select accessories then click Terminal. So in the future, you will use this method to follow every Linux command guide here.

Learn Linux Commands For Beginner to Advanced

Tips:

  • When I write an example Linux command will always start with a hash sign # and dollar $, what does that mean?
  • The hash sign # on the Linux terminal indicates that you are using the root user while the dollar signs $ indicates that the user you are currently using is a normal user/not a root user.
  • When I write a command in the tutorial the hash mark # means the command must be run using the root user, if you want to run from a normal user ( $ ) then add sudo. For example, the command $ sudo apt-get update is the
  • same as # apt-get update
  • while the dollar sign $ it means that the command is executed by the normal user (not root), for example, $ ls -la

sudo means that you want to run the command from the normal user but use root privileges

BASIC LINUX COMMANDS (LINUX COMMAND ESSENTIAL)

Linux basic commands or Linux command essential is a console-based Linux application that is included by all Linux distributions as a standard console application that functions as a tool for navigating and managing the system.

So without installing this console application, there must be in every distribution, so you are obliged to memorize these basic Linux commands as the basic capital to be able to operate Linux through the terminal or shell.

ADVANCED AND INTERMEDIATE LINUX COMMANDS

Although in this chapter we still use basic Linux commands, the use of these commands requires a deep understanding of the concept of making user permissions settings and files very strict.

Why is Linux resistant to malware/virus attacks? – The answer is because Linux applies an extra strict system of setting file access rights to users so that important system files can only be accessed and modified by the root user. So please pay attention when applying for user permissions and file attributes to Linux that you manage, because giving permissions to important files unwisely will weaken your Linux defenses.

LINUX COMMAND NETWORK SETTINGS/NETWORK

Although there is already a GUI tool available for managing networks (setting up wifi and lan) but it doesn’t hurt you to learn to manage a Linux network using a Linux terminal/command. This chapter will be very useful when you are troubleshooting/repairing or setting up a server that is accessed without a GUI.

Continue Reading
Advertisement

Latest

How to Create GraphsCharts Using Microsoft Word How to Create GraphsCharts Using Microsoft Word
MS Word28 mins ago

How to Create Graphs/Charts Using Microsoft Word

SHARE Often, when working on an assignment for a paper, paper, thesis, thesis, or dissertation, it is necessary to include...

How to delete my information from the Internet How to delete my information from the Internet
Internet1 day ago

How to delete my information from the Internet

SHARE The Internet is one of the best tools of the 21st century. With his arrival, the digital revolution began,...

How to report a fraudulent website How to report a fraudulent website
How-To1 day ago

How to report a fraudulent website

SHARE The Internet has reached such magnitude that for many unscrupulous people it has become a way to amass money...

How to upload YouTube videos to Instagram How to upload YouTube videos to Instagram
Internet1 day ago

How to upload YouTube videos to Instagram

SHARE Social networks have become one of the most important communications and entertainment media today and, of all of them,...

How to be YouTuber and earn money How to be YouTuber and earn money
Internet1 day ago

How to be YouTuber and earn money

SHARE The Internet has become a new source of income for people who know how to take advantage of social...

How to Shop on TikTok Shop Live, Also While Live Streaming How to Shop on TikTok Shop Live, Also While Live Streaming
TikTok1 day ago

How to Shop on TikTok Shop Live, Also While Live Streaming

SHARE Online shopping has now become a lifestyle for people and is available on many social media, including TikTok. The...

How to Check a PC that Supports Windows 11, Use PC Health Check How to Check a PC that Supports Windows 11, Use PC Health Check
Windows 111 day ago

How to Check a PC that Supports Windows 11, Use PC Health Check

SHARE Windows 11 will soon be available for general users. Ahead of its official launch, Microsoft has prepared various related...

How to Backup WhatsApp iPhone to iCloud How to Backup WhatsApp iPhone to iCloud
iPhone1 day ago

iPhone: How to Backup WhatsApp iPhone to iCloud

SHARE Are you a user of the iPhone who is actively wearing WhatsApp? If so, you must be familiar with...

How to Type Documents in Microsoft Word with Voice How to Type Documents in Microsoft Word with Voice
MS Word3 days ago

How to Type Documents in Microsoft Word with Voice

SHARE Have you ever known, if it turns out that you can type documents in Microsoft Word by voice? How...

How to calculate interest for a fixed term How to calculate interest for a fixed term
Business3 days ago

How to calculate interest for a fixed term

SHARE In this article, you will discover the implications that exist within the calculation of the interest rate of a...

Advertisement

Categories

Trending

Copy link
Powered by Social Snap