Home Java Javaftp FTPClient : Get System Type

Related Tutorials


Share on Google+Share on Google+

FTPClient : Get System Type

This section explain how to get system type by using method of FTPClient class in java.

FTPClient : Get System Type

This section explain how to get system type by using method of FTPClient class in java.

Get System Type :

String getSystemType() : Return type of this method is String. This method always holds the system type which is acquired from the ftp server. When you call this metthod it issue a SYST command to the FTP server and FTPClient put this value in cache till system is connected to the ftp server.

It throws FTPConnectionClosedException and IOException.

Example :

In this example we are using getSystemType() method of FTPClient class to get the system type of FTP server.

import java.io.IOException;

import org.apache.commons.net.ftp.FTPClient;
import org.apache.commons.net.ftp.FTPConnectionClosedException;

class FtpGetSystemType{
	public static void main(String[] args) throws IOException {
		FTPClient client = new FTPClient();
		boolean result;
		try {
			// Connect to the localhost
			// login to ftp server
			result = client.login("admin", "admin");

			if (result == true) {
				System.out.println("User successfully logged in.");
			} else {
				System.out.println("Login failed!");
			//Get System Type
			System.out.println("System type : "+client.getSystemType());

		} catch (FTPConnectionClosedException e) {
		} finally {
			try {
			} catch (FTPConnectionClosedException e) {

Output :

User successfully logged in.
System type : UNIX Type: L8


If you enjoyed this post then why not add us on Google+? Add us to your Circles

Liked it!  Share this Tutorial

Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: December 11, 2012

Related Tutorials

Discuss: FTPClient : Get System Type  

Post your Comment

Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image