server compilation error from client/server application
Hi guys, being new to Java I can't get my head around some differences with C++. I have a simple clent/server application written but I'm getting an error when compiling the server "cannot find symbol class Account". Three other separate classes are all compiled. I know this is staring me in the face but I would appreciate any suggestions!
Code:
package mypackage1;
import java.net.*;
import java.io.*;
public class Server
{
private int Account;
public static void main(String args[])
{
Account[] theAccounts =
{
new Account("Tom", 100f),
new Account("Richard", 200f),
new Account("Harry", 300f)
};
System.out.println("Displaying the Accounts");
theAccounts[0].display();
theAccounts[1].display();
theAccounts[2].display();
ServerSocket serverSocket = null;
try
{
serverSocket = new ServerSocket(5050);
System.out.println("Start listening on port 5050");
}
catch (IOException e)
{
System.out.println("Cannot listen on port: " + 5050 + ", " + e);
System.exit(1);
}
while (true) // infinite loop - wait for a client request
{
Socket clientSocket = null;
try
{
clientSocket = serverSocket.accept();
System.out.println("Accepted socket connection from client");
}
catch (IOException e)
{
System.out.println("Accept failed: 5050 " + e);
break;
} // create a new thread for the client
ConnectionHandler con = new ConnectionHandler(clientSocket);
if (con == null)
{
try
{
ObjectOutputStream os = new ObjectOutputStream(clientSocket.getOutputStream());
os.writeObject("error: Cannot open socket thread");
os.flush();
os.close();
}
catch (Exception ex)
{
System.out.println("Cannot send error back to client: 5050 " + ex);
}
}
else { con.init(); }
}
try
{
System.out.println("Closing server socket.");
serverSocket.close();
}
catch (IOException e)
{
System.err.println("Could not close server socket. " + e.getMessage());
}
}
}