Results 1 to 4 of 4

Thread: RMI program

  1. #1
    er1c550n20 is offline Member
    Join Date
    Mar 2010
    Posts
    9
    Rep Power
    0

    Default RMI program

    Can some1 tell whats mistake with my code..

    import java.rmi.*;
    import java.net.*;
    import java.rmi.server.*;

    public interface AddServerIntf extends Remote {
    double add(double d1, double d2) throws RemoteException;
    }

    public class AddServerImpl extends UnicastRemoteObject
    implements AddServerIntf {
    public AddServerImpl() throws RemoteException {
    }
    public double add(double d1, double d2) throws RemoteException {
    return d1 + d2;
    }
    }

    public class AddServer {
    public static void main(String args[]) {
    try {
    AddServerImpl addServerImpl = new AddServerImpl();
    Naming.rebind("AddServer", addServerImpl);
    }
    catch(Exception e) {
    System.out.println("Exception: " + e);
    }
    }
    }

    I am getting error which says
    M:\jdk1.5\bin\AddClient.java:6: cannot find symbol
    symbol : class AddServerIntf
    location: class AddClient
    AddServerIntf addServerIntf =
    ^
    M:\jdk1.5\bin\AddClient.java:7: cannot find symbol
    symbol : class AddServerIntf
    location: class AddClient
    (AddServerIntf)Naming.lookup(addServerURL);
    ^
    2 errors

    I have no idea what should i do.

  2. #2
    sukatoa's Avatar
    sukatoa is offline Senior Member
    Join Date
    Jan 2008
    Location
    Cebu City, Philippines
    Posts
    556
    Rep Power
    7

    Default

    does your code came from different java files?
    freedom exists in the world of ideas

  3. #3
    er1c550n20 is offline Member
    Join Date
    Mar 2010
    Posts
    9
    Rep Power
    0

    Default

    I dnt knw what you mean but if you are asking if my program has different segments yes it does..i got this prog from book which i am following

  4. #4
    gcalvin is offline Senior Member
    Join Date
    Mar 2010
    Posts
    953
    Rep Power
    5

    Default

    I don't know what you mean by "segments" but from your example, you should have three separate source files: AddServerIntf.java, AddServerImpl.java, and AddServer.java.

    And your error messages are coming from AddClient.java, the source of which you have not posted. Also, please use CODE tags when posting code.

    -Gary-

Similar Threads

  1. changing my program to array working program
    By Chewart in forum New To Java
    Replies: 39
    Last Post: 11-18-2009, 06:53 PM
  2. Execute A program from a Program!
    By Moncleared in forum Advanced Java
    Replies: 2
    Last Post: 02-22-2009, 04:17 PM
  3. Executing a program within a program
    By gibsonrocker800 in forum New To Java
    Replies: 5
    Last Post: 05-12-2008, 08:24 AM
  4. Replies: 0
    Last Post: 04-04-2008, 02:40 PM
  5. Replies: 0
    Last Post: 10-04-2007, 09:33 PM

Posting Permissions

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