CORE API / CATATAN</>↗Core API20 Agt 2008
package org.kodejava.util; import java.util.Properties; import java.util.Map; import java.util.HashMap; import java.util.Set; public class PropertiesToMap { public static void main(String[] args) { // Create a new instance of Properties. Properties properties = new Properties(); // Populate properties with a dummy application information properties.setProperty("app.name", "HTML Designer"); properties.setProperty("app.version", "1.0"); properties.setProperty("app.vendor", "HTM...
APACHE COMMONS / CATATAN</>↗Apache Commons16 Agt 2008
This example demonstrates how to use Apache Commons IO LastModifiedFileComparator class to sort files based on their last modified date in ascending and descending order. There are two comparators defined in this class, the LASTMODIFIED_COMPARATOR and the LASTMODIFIED_REVERSE. package org.kodejava.commons.io; import static org.apache.commons.io.comparator.LastModifiedFileComparator.*; import java.io.File; import java.util.Arrays; public class FileSortLastModified { public sta...
CORE API / CATATAN</>↗Core API13 Agt 2008
Java language which was there when the language was created. This multithreading capabilities can be said like running each program on their on CPU, although the machine only has a single CPU installed. To create a Thread program in Java we can extend the java.lang.Thread class and override the run() method. But as we know […]
CORE API / CATATAN</>↗Core API13 Agt 2008
The code below demonstrates how to obtain file system root available on your system. In Linux, you will have a single root (/) while on Windows you could get C:\ or D:\ that represent the root drives. package org.kodejava.io; import java.io.File; public class FileSystemRoot { public static void main(String[] args) { // List the available […]
CORE API / CATATAN</>↗Core API08 Agt 2008
package org.kodejava.io; import java.io.File; public class EmptyDirCheck { public static void main(String[] args) { File file = new File("D:/Downloads"); // Check to see if the object represent a directory. if (file.isDirectory()) { // Get list of file in the directory. When its length is not zero // the folder is not empty. String[] files = […]
TAGLIB / CATATAN</>↗Taglib08 Agt 2008
This example show how to format date in JSP using format tag library. We create a date object using the <jsp:useBean> taglib. To format the date we use the <fmt:formatDate> taglib. We assign the value attribute to the date object, set the type attribute as date and define the pattern how the date will be […]