-
cannot find symbol
please help me out ,
what is going wrong with this code
//MyServer.java
package ju.ch38.server;
import java.rmi.*;
public interface MyServer extends Remote
{
int getDataNum() throws RemoteException;
String getData(int n) throws RemoteException;
}//End of MyServer.java
//MyServerImpl.java
package ju.ch38.server;
import java.rmi.*;
import java.rmi.server.*;
public class MyServerImpl extends UnicastRemoteObject
implements MyServer
{
static String hostname = "ubuntu";
static String data[] = {"Remote","Method","Invocation","Is","Greate"};
public MyServerImpl() throws RemoteException
{
super();
}
public int getDataNum() throws RemoteException
{
return data.length;
}
public String getData(int n) throws RemoteException
{
return data[n%data.length];
}
public static void main(String args[])
{
System.setSecurityManager(new RMISecurityManager());
try
{
MyServerImpl instance = new MyServerImpl();
Naming.rebind("//"+hostname+"/MyServer",instance);
System.out.println("I'm registered! ");
}
catch(Exception ex)
{
System.out.println(ex);
}
}
}//end of MyServerImpl.java
when i compiled got this error.
administrator@ubuntu://home/administrator/workspace/JavaTP/src/ju/ch38/server$ javac MyServer.java
administrator@ubuntu://home/administrator/workspace/JavaTP/src/ju/ch38/server$ javac MyServerImpl.java
MyServerImpl.java:9: cannot find symbol
symbol: class MyServer
implements MyServer
^
1 error
thanks for help.
-
Re: cannot find symbol
Well while looking at the exception it seems more likely that you have named the class and interface same "MyServer" but looking at your code negates this.
And when i compiles it on my machine, it compiles fine.