About Java RMI
Hello:
I fullinstalled Mandrake 9.2 and it came with a java compiler. I'm not sure if it's Sun's official compiler but it does the trick.
I wrote this little example of a distributed object Using RMI, I did:
public interface Calculator extends java.rmi.Remote
{
public long add(long a, long b) throws java.rmi.RemoteException;
public long sub(long a, long b) throws java.rmi.RemoteException;
public long mul(long a, long b) throws java.rmi.RemoteException;
public long div(long a, long b) throws java.rmi.RemoteException;
}
And it's implementation:
public class CalculatorImpl extends java.rmi.server.UnicastRemoteObject implements Calculator
{
public CalculatorImpl() throws java.rmi.RemoteException
{ super(); }
public long add(long a, long b) throws java.rmi.RemoteException
{ return a+b;}
public long sub(long a, long b) throws java.rmi.RemoteException
{ return a-b; }
public long mul(long a, long b) throws java.rmi.RemoteException
{ return a*b; }
public long div(long a, long b) throws java.rmi.RemoteException
{ return a/b; }
}
I did javac on Both and it goes fine.
However when I rmic on CalculatorImpl it says:
java.lang.ClassNotFoundException: CalculatorImpl
at java.lang.Class.forName (Class.java)
at java.lang.Class.forName (Class.java:44)
at kaffe.rmi.rmic.RMIC.findClass (RMIC.java:149)
at kaffe.rmi.rmic.RMIC.analyzeClass (RMIC.java:115)
at kaffe.rmi.rmic.RMIC.processClass (RMIC.java:84)
at kaffe.rmi.rmic.RMIC.run (RMIC.java:73)
at kaffe.rmi.rmic.RMIC.main (RMIC.java:52)
could it be because of the compiler? Any ideas?
Thanks!!!
|