The Artima Developer Community
Sponsored Link

Java Answers Forum
class not found exception

1 reply on 1 page. Most recent reply: Oct 4, 2009 10:55 PM by Vincent O'Sullivan

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 1 reply on 1 page
Oren Zietman

Posts: 1
Nickname: moondance7
Registered: Oct, 2009

class not found exception Posted: Oct 3, 2009 8:08 PM
Reply to this message Reply
Advertisement
Hi,
I am new to java and eclipse. I am trying to do the following :
I have 2 files :
main server.java
import java.io.FileReader;
import java.io.IOException;
import java.net.ServerSocket;
import java.util.Properties;

public class MainServer {

/**
* @param args
* @throws IOException
*/
public static void main(String[] args) throws IOException
{
FileReader cfgFile = new FileReader("bin\\cfg\\mainserver.cfg");
Properties MainServerProperties = new Properties();
int socket = 0;
try
{
MainServerProperties.load(cfgFile);
String strSocket = MainServerProperties.getProperty("socket");
socket = Integer.parseInt(strSocket);
System.out.println("the server socket is " + socket);
}
catch (IOException e)
{

System.err.println("Could not read file " + cfgFile);
System.exit(-1);
}
ServerSocket serverSocket = null;
boolean listening = true;
try
{
serverSocket = new ServerSocket(socket);
while (listening)
{
MainServerThread thread = new MainServerThread(serverSocket.accept());
thread.start();
}
}
catch (IOException e)
{
System.err.println("Could not listen on port: " + socket);
System.exit(-1);
}


}

}

mainserverthread.java
import java.net.Socket;


public class MainServerThread
{

public MainServerThread(Socket incoming)
{
// TODO Auto-generated constructor stub
m_incomingSocket = incoming;
}
public void start()
{
System.out.println("Accepting data from socket" + m_incomingSocket);
}
Socket m_incomingSocket;
}

when I hit the line :
MainServerThread thread = new MainServerThread(serverSocket.accept());

I get not found class exception. Any ideas ?

I am using windows XP service pack 3
eclipse build : 20090920-1017

thanks
Oren


Vincent O'Sullivan

Posts: 724
Nickname: vincent
Registered: Nov, 2002

Re: class not found exception Posted: Oct 4, 2009 10:55 PM
Reply to this message Reply
> I have 2 files :
> main server.java
:
> public class MainServer {
:
> mainserverthread.java
:
> public class MainServerThread

The two files should be called MainServer.java and MainServerThread.java respectively. The file names must match the class names (no spaces and case sensitive).

Flat View: This topic has 1 reply on 1 page
Topic: BeansBinding issue Previous Topic   Next Topic Topic: Java Interface

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use