Friday, August 22, 2025

How to Install OpenJDK 11 on Ubuntu 24.04.3 LTS and Set Environment Variables

Java is one of the most popular programming languages, powering enterprise systems, cloud applications, and Android development. On Ubuntu 24.04.3 LTS, you can easily install OpenJDK 11, which is a Long-Term Support (LTS) version and widely used in production environments.

Here, you’ll learn:

1. What OpenJDK 11 is and why to use it

2. Step-by-step installation on Ubuntu 24.04.3

3. How to verify your Java installation

4. How to set up environment variables (JAVA_HOME and PATH)


1. What is OpenJDK 11?

OpenJDK (Open Java Development Kit) is the official open-source implementation of Java SE (Standard Edition).

  • OpenJDK 11 was first released in September 2018.
  • It is a Long-Term Support (LTS) release, making it a stable choice for enterprises and developers.
  • It provides tools such as the Java Runtime Environment (JRE) and Java Compiler (javac).

2.  Step 1: Update Your System


Always update your package index before installing new software:

sudo apt update 


    













sudo apt upgrade


 










Step 2: Install OpenJDK 11

Ubuntu’s repositories include OpenJDK 11. To install it, run:

sudo apt install openjdk-11-jdk 












This installs both the JDK (Java Development Kit) and the JRE (Java Runtime Environment).

 3. How to verify your Java installation


Check the installed Java version:

java -version

You should see output similar to:

openjdk version "11.0.28" 2025-07-15
OpenJDK Runtime Environment (build 11.0.28+6-post-Ubuntu-1ubuntu124.04.1)




To check the compiler:

javac -version



4. How to set up environment variables (JAVA_HOME and PATH)

Some applications (e.g., Tomcat, Maven, Gradle) require JAVA_HOME to be set.

a) Find the Installation Path

sudo update-alternatives --config java

You’ll see something like:

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






 The Java home directory is:

/usr/lib/jvm/java-11-openjdk-amd64



b) Edit Your Profile

sudo vi /etc/profile



Add these lines at the bottom:

# Java Environment Variables
export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64
export PATH=$JAVA_HOME/bin:$PATH

























c) Apply Changes

Saving and exiting using following command.

:wq 


d) Verify

echo $JAVA_HOME

Output should be:

/usr/lib/jvm/java-11-openjdk-amd64













Wednesday, March 18, 2020

Install Mysql server on ubuntu 18.04.4 LTS

MySQL is one of the most popular open-source relational database management systems. It’s widely used in web applications, enterprise software, and data-driven projects.

This will show you how to install MySQL Server on Ubuntu 18.04.4 LTS, set the root password, and verify the installation.

Step 1: Update Package Index

Open a terminal and update your system’s package index:

sudo apt update

Step 2: Install MySQL Server

Install MySQL Server package:

sudo apt install mysql-server


The installation will automatically start the MySQL service.

No password is required during installation as the default authentication plugin is auth_socket.

Step 3: Verify MySQL Installation

Exit the current terminal and open a new terminal, then try logging in:

mysql


You may get the error:

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)


This happens because MySQL on Ubuntu 18.04 uses auth_socket by default, which requires the root user to log in via the system user account.

Step 4: Log in as Root

Use sudo to access MySQL as root:

sudo mysql

Step 5: Set Root Password

Once inside the MySQL shell, run the following command to set a root password and switch to the mysql_native_password plugin:

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'your_password';


Replace 'your_password' with a strong password of your choice.

Step 6: Apply Changes

Flush privileges so the changes take effect:

FLUSH PRIVILEGES;

Step 7: Verify MySQL Access

Now, you can log out of MySQL and log in again using the root password:

mysql -u root -p


Enter your password when prompted. Then verify your databases:

SHOW DATABASES;


You should see the default MySQL databases like mysql, information_schema, performance_schema, etc.

Tuesday, February 25, 2020

Install Oracle Java 11 on Ubuntu 18.04.4 LTS

Oracle Java 11 is a Long-Term Support (LTS) version widely used for enterprise applications, web servers, and development environments. Unlike OpenJDK, Oracle Java comes with commercial support and additional features.

This guide will show you step-by-step how to install Oracle Java 11 on Ubuntu 18.04.4 LTS.


Open the terminal and type these command in the terminal.

Step 1: Create a Local Installer Directory

Oracle Java installer requires a local cache directory. Run:

sudo mkdir -p /var/cache/oracle-jdk11-installer-local/


This creates a folder where the installer will look for the downloaded .tar.gz file.

Step 2: Move the Downloaded JDK File

Navigate to the folder where you downloaded the Oracle JDK 11 .tar.gz file:

cd ~/Downloads


Then copy the file to the local installer directory:

sudo cp jdk-11.0.6_linux-x64_bin.tar.gz /var/cache/oracle-jdk11-installer-local/

Step 3: Remove Previous Oracle Java 11 (Optional)

If you have a previously installed Oracle Java 11, remove it first:

sudo apt purge oracle-java11-installer


This ensures a clean installation.

Step 4: Add the Linux Uprising PPA

Add the Linux Uprising PPA to get the Oracle Java installer:

sudo add-apt-repository ppa:linuxuprising/java
sudo apt-get update

Step 5: Install Oracle Java 11

Install the local Oracle Java 11 installer:

sudo apt install oracle-java11-installer-local

Step 6: Set Oracle Java 11 as Default

To set Java 11 as the default version for your system, run:

sudo apt install oracle-java11-set-default-local

     



Thursday, February 25, 2016

iReport Designer(5.6.0) cannot open in JDK 8

I was trying to change the jdkhome using jdk 8 with iReport Designer 5.6.0. But I had failed.Then I installed jdk 7 and changed the jdkhome as jdk 7.After that I have successfully installed iReport Designer.

These are the steps.

Why This Happens

iReport 5.6.0 was released before JDK 8, so some classes and libraries are incompatible with the newer Java runtime.

Attempting to run iReport with JDK 8 will result in the program failing to start, with no clear error message.

Step-by-Step Solution
1. Install JDK 7

Download and install Java Development Kit (JDK) 1.7 from Oracle’s archive:
Oracle JDK 7 Downloads

Install it in a folder like:

C:\Program Files\Java\jdk1.7.0_45

2. Update iReport Configuration

Go to the iReport installation folder. For example:

C:\Program Files\iReport-5.6.0\etc


Open the ireport.conf file with a text editor (like Notepad).

Find the line for jdkhome. It might look like:

#jdkhome="/path/to/jdk"


Change it to point to your JDK 7 folder, not the JRE:

jdkhome="C:/Program Files/Java/jdk1.7.0_45"


Save the file.

Do not point it to the jre folder—iReport requires the full JDK.

3. Run iReport

Double-click ireport.exe in your iReport installation folder.

The application should now start successfully using JDK 7.

 Additional Tips

If you have multiple JDK versions installed, ensure JDK 7 is set in iReport even if JDK 8 is your system default.

For Eclipse or NetBeans integration, configure the project’s Java Compiler to use JDK 7 for iReport compatibility.