This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I have done quite a bit of searching on both here and Google and have found a lot of useful FTP Client information.
I have applied quite a bit of it, but keep running into the following exception: Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/net/telnet/TelnetInputStream at newftp.main(newftp.java:12)
Here is a sample code snippet.
As you can see, I have the commons net classes because it does not give an error on the import statement.
The file org/apache/commons/net/telnet/TelnetInputStream.java does exist.
The path org/apache/commons/net/* is in my compiling folder. I am using the command line compiler javac from Java version 1.4.1_05.
Any help would be appreciated. Won't surprise me if it's a classpath error, but I can't seem to set it correctly to work. Thanks. [ May 13, 2005: Message edited by: Joe Ess ]
If there's no reason to be compiling the source, get rid of that source directory and just include the binary distribution (i.e. zip or jar) in the classpath. If you do want to compile the file from apache commons, add the parent directory of org (or the current directory ".") to the classpath. The compiler will search the classpath for both source and compiled class files. More on how that works in the javac documentation.
I already tried "javac -cp . newftp.java" and the error persisted.
Next, per your suggest, I downloaded the zip from Jakarta's website at http://apache.mirrors.versehost.com/jakarta/commons/net/binaries/commons-net-1.4.0.zip and placed it in my compiling folder. Then pulled commons-net-1.4.0.jar out of that zip leaving it in the same folder. Renamed the org folder to org2 just so it would not be read by default of the javac anymore. But now it says [/b]newftp.java:1: package org.apache.commons.net.ftp does not exist import org.apache.commons.net.ftp.FTPClient;[/b] and I cannot seem to get jar to work to extract the commons jar for some reason.