August 14, 2022

How to get the Tomcat home directory in Java

Is there a function in Java to retrieve the Tomcat (Catalina) home directory? Yes, Tomcat home directory or Catalina directory is stored at the Java System Property environment. If the Java web application is deployed into Tomcat web server, we can get the Tomcat directory with the following command: System.getProperty(“catalina.base”);

How to get the Tomcat home directory in Java Read More

How to Set JAVA_HOME environment variable on macOS

This article shows how to set the $JAVA_HOME environment variable on older Mac OS X and the latest macOS 11. Steps to set the $JAVA_HOME environment variable on macOS: 1 – Find out your macOS version; 2 – Find out which shell you are using, bash or zsh? ; 3 – For zsh shell, export $JAVA_HOME at ~/.zshenv or ~/.zshrc ; 4 – For bash shell, export $JAVA_HOME at ~/.bash_profile or ~/.bashrc ; 5 – Test with echo $JAVA_HOME.

How to Set JAVA_HOME environment variable on macOS Read More

How to check JDK version that installed on your computer

The Java development kit (JDK) contains tools for Java development, and the Java Runtime Environment (JRE) contains a JVM to convert byte code .class to machine code, and execute it, in short, the JRE runs Java program. We can use javac -version to find out the version of the installed JDK. We can use java -version to find out the version of the installed JRE. The JDK and JRE versions can be different on the same computer. Multiple JDK and JRE versions are allowed on the same computer; it is better to find out which version is configured in the system classpath to run or compile the Java program.

How to check JDK version that installed on your computer Read More