If you are working on system programming in Java, it is very common to run the processes for starting some external applications. Runtime class defines a method to execute the external applications. This example shows how to open another eclipse instance from the Java program. This example opens the eclipse IDE, and the closes the …
How To Write Properties To XML File In Java
In my previous tutorial I have written a sample program to write properties to a properties file. This example is writing the properties object values to a XML file. Here we are using the storeToXML method instead of just store method. This method will create the XML file with the content in the properties object. Lets look at …
How To Get Java System Properties Values
Java’s System class maintains a property object which contains the various details of the current user, Java version, operating system, etc. These are predefined values and can be easily accessed by calling the System class level methods. This utility is very useful to get the native operating system details. Lets look at the below example …
How To Get IP Address In Java
This is simple example to demonstrate the use of InetAddress.getLocalHost() API to retrieve the IP Address details of your local system or where ever the Java program is executed. If you write a server applications, this can be used for getting the server’s IP Address. Lets look at the example code to display the IP Address …
How To Get Free Disk Space In Java (Windows)
This simple Java program helps you to get the free disk space on your windows machines. Here I have used three methods for getting the disk space from your system. getTotalSpace() getUsableSpace() getFreeSpace() The above methods are introduced from Java 6.0 and as part of the java.io package. The below example prints the disk space …
How To Test Internet Connection Using Java
It is very often required to test the internet connection for performing some operations. If there is no internet connection established, then alternative logic will be executed. Java provides useful classes in java.net package for connecting to the internet. Here I written a very simple example to test if your system is connected to internet. …
How To Check Network Connection Using Java
It if often required to get the details of the network connection in your desktop. It will be useful if you could get the details of all the connected network details for the future operations. Java has set of classes in the java.net package which is useful for the Java network programming. In this example …
How To Get OS In Java
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…