Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: cannot find symbol

  1. #1
    Junior Member
    Join Date
    Dec 2011
    Location
    India
    Posts
    8
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default 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.


  2. #2
    Think of me.... Mr.777's Avatar
    Join Date
    Mar 2011
    Location
    Pakistan
    Posts
    1,136
    My Mood
    Grumpy
    Thanks
    20
    Thanked 82 Times in 78 Posts
    Blog Entries
    1

    Default 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.

Similar Threads

  1. Cannot find symbol
    By waarten in forum What's Wrong With My Code?
    Replies: 18
    Last Post: January 11th, 2012, 03:15 PM
  2. Cannot find symbol
    By BadgerWatch in forum What's Wrong With My Code?
    Replies: 4
    Last Post: November 6th, 2011, 11:25 PM
  3. [SOLVED] cannot find symbol error
    By Topflyt in forum What's Wrong With My Code?
    Replies: 9
    Last Post: November 5th, 2011, 08:57 AM
  4. Cannot find Symbol?
    By defmetalhead in forum What's Wrong With My Code?
    Replies: 8
    Last Post: July 5th, 2011, 08:48 AM
  5. Cannot find symbol?
    By stealthmonkey in forum What's Wrong With My Code?
    Replies: 3
    Last Post: December 10th, 2010, 10:02 PM