The Java Archive Tool (JAR) Examples
Learn how to use JAR tool: 1 – Create a jar file, 2 – Update a jar file , 3 – Extract a jar file , 4 – List files from a jar file, 5 – Add manifest into jar file
Favourite tutorials for developers
Core Java is the fundamental form of Java. We use it in all Java platforms and technologies. Without going through core Java, it is impossible to advance to advanced Java. Unlike core Java, advanced Java is a specialization of the core Java in some particular domain, such as database handling, networking, and the web.
Learn how to use JAR tool: 1 – Create a jar file, 2 – Update a jar file , 3 – Extract a jar file , 4 – List files from a jar file, 5 – Add manifest into jar file
In Java, you can use manifest file to define application’s entry point, adding classpath or package version for a JAR file. In this short tutorial , we will show you how to add a custom manifest file into a Jar file.
In this tutorial, we will show you how to create a executable JAR – When you double click on it, it runs the defined main class in manifest file.
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”);
This tutorial shows you how to set a JAVA_HOME system variable on Windows 10. Tested with :Windows 10JDK 1.8
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.
This article shows how to install Java JDK on macOS, Homebrew package manager, manual installation, and switch between different JDK versions. Tested with: macOS 11 Big Sur; Homebrew 2.7.4J; DK 8, 14, 16, 16 (AdoptOpenJDK and OpenJDK)
On Ubuntu, we can add JAVA_HOME environment variable in /etc/environment file. Note/etc/environment system-wide environment variable settings, which means all users use it. It is not a script file, but rather consists of assignment expressions, one per line. We need admin or sudo to modify this it.
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.
Since Gson version 1.6, two new classes JsonReader and JsonWriter are introduced to provide streaming processing on JSON data. Read this Gson streaming documentation to understand what are the benefits of using it: JsonWriter – Write JSON as a stream.JsonReader – Read JSON as a stream.