XMLSecTool Errors and Solutions

JAVA_HOME Environment Variable Not Set

Error Message
Error Message: JAVA_HOME environment variable not set

Problem

This Problem occurs when the java path is not set in the environment variable.

Solution

Execute the following commands to include the java path:

  • readlink -f $(which java)
    This command prints the path of the java location.
    Example: /usr/lib/jvm/java-21-openjdk-amd64/bin/java
  • Login as root user (sudo su) and run the command sudo vi ~/.bashrc and include the following lines:
    • export JAVA_HOME=/usr/lib/jvm/java-21-openjdk-amd64

      Enter the path of the java location obtained from the first command here, excluding the bin/java.

    • export PATH=$JAVA_HOME/bin:$PATH
  • After adding the two lines in the bashrc file execute the command source ~/.bashrc and then logout from the root user.
  • The Java environmental variable will be set by executing the above commands.