How To Get Classpath in Java

java-thumbnail

This example demonstrates how to get the classpath string using the Java program. It is simple that you just need to use the System.getProperty() method with the classpath variable name which will return the classpath string. Lets look at the example. Output This is the simple example to get the classpath configuration in your system […]

How To Set Default Locale In Java

java-thumbnail

Every system has its own default locale set in the native library. It is based on the current location or country of that operating system is accessed. Java has API to access the locales and display the text on appropriate languages. In some cases, the default locale may not be correct or it needs change […]

How To Get OS In Java

java-thumbnail

This post writes a simple Java example program  to get the current operating system. There is a system property in Java, System.getProperty(“os.name”) which returns the operating system. However, this utility returns the operating system type like Windows, Mac, Unix or Linux. Lets look at the below example. GetOSExample.java Output…

File Modified Date Manipulation in Java

java-thumbnail

This example demonstrates the basic data manipulation operation in a File object. Java File object has set of methods to perform the following operations: Get the file last modified date Change the file modified date Lets look at the example to see how the above operations are implemented in Java example program. We use SImpleDateFormat […]

How To Set The File Permissions In Java

java-thumbnail

Setting the file permissions in Java is OS specific. Each type of file system have different kind of file systems. Java provides the very generic solution to set the file permissions for all kind of file systems. This example demonstrates how to set file permissions to a file in the Linux operating system using Java […]

Convert InputStream To String In Java

java-thumbnail

In my previous example, I have written a simple program to covert string object to InputStream. This tutorial does the reverse, converting inputstream into a string object. Lets look at the example.

Convert String To InputStream In Java

java-thumbnail

This is simple exmaple for converting string object to a InputStream and then read it using the BufferedReader.

How To Delete Temporary File In Java

java-thumbnail

In my previous article I have explained about how to create and write into a temporary file. Normally this file will be deleted once the operation is completed. Lets look at this simple example, to understand getting the temporary file path and deleting it on exit of the program. Delete Temporary File Example Output…

How To Create + Write Temporary File In Java

java-thumbnail

If you are working on the file operations, it is obvious that you have to use the temporary file concept for the file transfer activities. When you download or transfer a file from one location to another, a temporary file is created and then data transferred to the location. Once the entire data is transferred, […]

Create Directory in Java

java-thumbnail

With the help of File IO API in Java, you can create a single directory or multiple directories in the disk. Here I wrote a very simple example to demonstrate the use of File class and create the directories. mkdir – Creates a directory mkdirs – Creates multiple directories Create Directory Example CreateDirectoryDemo.java

Close
Please support the site
By clicking any of these buttons you help our site to get better