SupportWriter space ↗
REFERENCE LIBRARY

References from other publishers

Republished articles with source attribution. This collection is separate from Diary Coding’s original guides and does not display ads.

Read original guides → · Editorial policy

FOR YOUR CURIOSITY

Latest notes.

ZIP AND GZIP / NOTES</>↗
Zip and GZIP16 May 2008

How do I decompress a zip file using ZipInputStream?

The code below shows how to decompress and extract files from a zip archive. In the example we use the java.util.zip.ZipInputStream class. package org.kodejava.util.zip; import java.io.*; import java.util.zip.ZipInputStream; import java.util.zip.ZipEntry; public class UnzipDemo { public static void main(String[] args) { String zipName = "data.zip"; try (FileInputStream fis = new FileInputStream(zipName); ZipInputStream zis = new ZipInputStream(new […]

Wayan · 1 min read
CORE API / NOTES</>↗
Core API15 May 2008

How do I check if a string is a valid date?

The following code can be used to validate if a string contains a valid date information. The pattern of the date is defined by the java.text.SimpleDateFormat object. When the date is not valid a java.text.ParseException will be thrown. package org.kodejava.text; import java.text.SimpleDateFormat; import java.text.ParseException; public class DateValidation { public static void main(String[] args) { SimpleDateFormat […]

Wayan · 1 min read
CORE API / NOTES</>↗
Core API13 May 2008

How do I get Java Home directory?

To get Java Home directory we can obtain it from system properties using the java.home key. package org.kodejava.lang; public class JavaHomeDirectory { public static void main(String[] args) { String javaHome = System.getProperty("java.home"); System.out.println("JAVA HOME = " + javaHome); } } On my computer this code give me the following output: JAVA HOME = C:\Program Files\Java\jdk-17

Wayan · 1 min read
CORE API / NOTES</>↗
Core API10 May 2008

How do I get the username of operating system active user?

This example show you how to get operating system active user’s login name. We can obtain the username of current user by reading system properties using the user.name key. package org.kodejava.lang; public class GettingUserName { public static void main(String[] args) { String username = System.getProperty("user.name"); System.out.println("username = " + username); } }

Wayan · 1 min read
JSP / NOTES</>↗
JSP06 May 2008

How do I get web application context path in JSP?

This example show you how to obtain web application context path in JSP using Expression Language (EL) feature of JSP. To get the context path we can utilize the pageContext, it is an implicit object that available on every JSP pages. From this object you can get access to various object such as: servletContext session […]

Wayan · 2 min read
SERVLET / NOTES</>↗
Servlet03 May 2008

How do I get web application context path?

The context path always comes first in a request URI. The path starts with a “/” character but does not end with a “/” character. When I have a web application with the URL like http://localhost:8080/myapp` then/myapp` is the context path. For servlets in the default (root) context, this method returns "" (empty string). package […]

Wayan · 1 min read
✳

Knowledge grows when shared.

Stay curious. There is always something new to learn.

Explore notes ↗
Putu Adi Guna Permana
ABOUT THE AUTHOR

Dr (C). Ir. Putu Adi Guna Permana, S.Kom., M.Kom., IPM., ASEAN Eng.

Writer and founder of Diary Coding — sharing notes, tutorials, and experiences about programming for anyone who wants to keep learning.