Results 1 to 2 of 2
  1. #1
    23Zone is offline Member
    Join Date
    Feb 2010
    Posts
    1
    Rep Power
    0

    Default "Cannot find symbol" errors in Java

    Hey, I am making a "simple" FTP Client and, through reading and learning the basics, I have seemingly gotten through most of the simple things. Currently, I am getting compiling errors (Cannot find symbol) in the code shown below, mostly related to the FTPCommand variables in each method below and two others related to the "myIP = myInet.getHostAddress();", "connect(hostname, _defaultPort_);" and "__modes.substring(fileType, fileType + 1));" lines with the bold areas being where the arrow is pointing.

    From what I've read, I think I must declare the variables, but when I do that or attempt to, I get more errors. I appreciate the help and responses. Thanks.

    import java.net.*;
    import java.io.*;
    import java.lang.*;
    import java.io.IOException;
    import java.net.InetAddress;
    import org.apache.commons.net.SocketClient;
    import org.apache.commons.net.ftp.FTPClient;
    import org.apache.commons.net.ftp.FTP;


    public class UIAgent {
    public static void main(String argv[]) throws Exception {
    }

    // Connect to FTP Server
    public static InetAddress getLocalHost() throws UnknownHostException
    {
    InetAddress myInet;
    myInet = InetAddress.getLocalHost();
    }

    public String getHostAddress()
    {
    String myIP;
    myIP = myInet.getHostAddress();
    }


    public void connect(String hostname) throws SocketException, IOException
    {
    connect(hostname, _defaultPort_);
    System.out.println("CONNECT accepted for FTP server at host and port");
    }

    public int user(String username) throws IOException
    {
    return sendCommand(FTPCommand.USER, username);
    }

    public int pass(String password) throws IOException
    {

    return sendCommand(FTPCommand.PASS, password);
    }

    public int syst() throws IOException
    {

    return sendCommand(FTPCommand.SYST);
    }

    public int type(int fileType) throws IOException
    {

    return sendCommand(FTPCommand.TYPE, __modes.substring(fileType, fileType + 1));
    }


    // Get file from the FTP Server
    public int retr(String pathname) throws IOException
    {

    return sendCommand(FTPCommand.RETR, pathname);
    }


    // Quit the FTP Server
    public int quit() throws IOException
    {

    return sendCommand(FTPCommand.QUIT);
    System.out.println("QUIT accepted, terminating FTP client");
    }

    }

  2. #2
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    8

    Default

    Don't try to write FTP clients before you understand the basics of classes, classpath,compiling and running programs. It is best to start with Sun's(Oracle) java tutorial to learn the basics of the language first.

Similar Threads

  1. Compiling probem "cannot find symbol"
    By thegluups in forum New To Java
    Replies: 27
    Last Post: 01-18-2010, 08:53 PM
  2. Error "can not find symbol variable"
    By FullMetalHollow in forum New To Java
    Replies: 5
    Last Post: 10-04-2009, 09:51 PM
  3. cannot find symbol for "list.addFirst"
    By alexbryan_08 in forum New To Java
    Replies: 10
    Last Post: 08-26-2009, 08:55 AM
  4. Replies: 1
    Last Post: 10-20-2008, 07:35 AM
  5. "Cannont find symbol Constructor" error
    By Welsh in forum New To Java
    Replies: 7
    Last Post: 01-25-2008, 12:12 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •