Getting error with sun.net.ftp.FtpClient by using JDK 1.7

michdraft picture michdraft · Dec 20, 2013 · Viewed 15.3k times · Source

I have developed a project that uses sun.net.ftp.FtpClient class to download a file from an ftp server whil i was using JDK 1.5. Now i have switched to JDK 1.7 and i get the following error.

java: sun.net.ftp.FtpClient is abstract; cannot be instantiated

It seams to me JDK 1.7 does not support FtpClient .

Any suggestions to solve this issue are welcome?

Answer

andrel picture andrel · Dec 20, 2013

You shouldn't use classes in sun.* - there are no guarantee that they will remain compatible between java-versions.

I would suggest a rewrite to use something like Apache Commons FTP instead. It should be pretty simple to use, so it should be an easy job.