Skip to main content


Showing posts from May, 2008

Java Library to get Folder Content

FolderContentLib is the java library published under GPL license written by Chandima prabath ariyarathna. Using this library, you can check all file and file path inside the folder include the file which are include in the subfolders .


File content(String folderPath)
Using this method you can get file names which are inside the folder.This method return String Array.

PathContent(String folderPath)
Using this method you can get file names and path which are inside the folder.This method return String Array.

How to access:-
Example source code to access library.

If you want to get source code Click on the picture

Download LibDownload Source

Open source license

software licensing

Allowing an individual or group to use a piece of software. Nearly all applications are licensed rather than sold. There are a variety of different types of software licenses. Some are based on the number machines on which the licensed program can run whereas others are based on the number of users that can use the program. Most personal computer software licenses allow you to run the program on only one machine and to make copies of the software only for backup purposes. Some licenses also allow you to run the program on different computers as long as you don't use the copies simultaneously


Copyright (C) 2007 Free Software Foundation, Inc.

Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.

This version of the GNU Lesser General Public License incorporates the terms and conditions of version 3 of the GNU General Public License, supplemented by th…

Get Local Ip address using java

Its very simple ,for the testing you want to import "" package

//Get an instance of InetAddress for the local computer
InetAddress inetAddress = InetAddress.getLocalHost();

//Get a string representation of the ip address
String ipAddress = inetAddress.getHostAddress();

//Print the ip address

Java Source code to check patition free space in Linux & Windows

this is java code for check free space in partition..

private static final Pattern NON_DIGIT = Pattern.compile("(([^0-9]*))");
private static final Pattern WORDS = Pattern.compile("(\\s*(\\S+)\\s*)");

public static long getFreeSpace(File file) {
final String osName = System.getProperty("");
try {
if (osName.indexOf("Windows") != -1) {
return freeSpaceWindow(file);
} else if (osName.equals("Linux")) {
return freeSpaceUnix(file);
} else {
System.err.println("Unknown os=" + osName);
return freeSpaceUnix(file);
} catch (IOException ex) {
return -1;
} // end getFreeSpace

private static long freeSpaceUnix(File file) throws IOException {
Process process = Runtime.getRuntime().exec("df");

How to write Port Scaner using Java

This is source code for port scanner.Very easy to implement.If port is available return true.If port is unavailable return false.

public static boolean PortScanner(String host,int port) throws UnknownHostException

Socket worker = null; //makes all the connections
int Port =port; //make port
InetAddress hostAddress; //stores the IP address of the target
boolean status=false;
String Host=host;


worker= new Socket(hostAddress,Port);
catch( e)

catch( e){}
catch(NullPointerException e){}

return status;