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.

CORE API / NOTES</>↗
Core API20 Oct 2006

How can I change file attribute to writable?

Prior to Java 1.6 the java.io.File class doesn’t include a method to change a read only file attribute and make it writable. To do this on the old days we have to utilize or called operating system specific command. In Java 1.6 a new method named setWritable() was introduced to do exactly what the method […]

Wayan · 2 min read
CORE API / NOTES</>↗
Core API19 Oct 2006

How can I change file attribute to read only?

This code demonstrate how we can modify file attribute to be read only. File class has a setReadOnly() method to make file read only and a canWrite() method to know whether it is writable or not. package org.kodejava.io; import java.io.File; public class FileReadOnlyExample { public static void main(String[] args) throws Exception { File file = […]

Wayan · 1 min read
CORE API / NOTES</>↗
Core API14 Oct 2006

How do I know the memory size in virtual machine?

If you want to know the free memory, and the total memory available in the Java runtime environment then you can use the following code snippet to check. package org.kodejava.lang; public class MemoryExample { public static void main(String[] args) { long freeMemory = Runtime.getRuntime().freeMemory(); long totalMemory = Runtime.getRuntime().totalMemory(); System.out.println("Free Memory = " + freeMemory); System.out.println("Total […]

Wayan · 1 min read
CORE API / NOTES</>↗
Core API14 Oct 2006

How do I ping a host?

Since Java 1.5 (Tiger) the java.net.InetAddress class introduces isReachable() method that can be used to ping or check if the address specified by the InetAddress is reachable. package org.kodejava.net; import java.net.InetAddress; public class PingExample { public static void main(String[] args) { try { InetAddress address = InetAddress.getByName("172.16.2.0"); // Try to reach the specified address within […]

Wayan · 1 min read
CORE API / NOTES</>↗
Core API12 Oct 2006

How do I append data to a text file?

One of the common task related to a text file is to append or add some contents to the file. It’s really simple to do this in Java using a FileWriter class. This class has a constructor that accept a boolean parameter call append. By setting this value to true a new data will be […]

Wayan · 1 min read
SWING / NOTES</>↗
Swing09 Oct 2006

How do I change the cursor shape in Swing?

Using the following code snippet you can change the shape of mouse cursor in your Java Swing desktop application. The cursor is represented by the java.awt.Cursor class. Create an instance of Cursor using the new operator and pass the cursor type to the Cursor class constructor. We can change Swing’s objects (JLabel, JTextArea, JButton, etc) […]

Wayan · 2 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.