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!!! |
Hi,
You have to do more than just compile the 'Calculator' classes. You should just do a little more reading on RMI, and find out about starting the rmi server (general terms of course). Perhaps check out this as a starter: http://java.sun.com/docs/books/tutor...lementing.html |
I do have the server and client classes..... but the error is the same. Perhaps on the same dir the client and server?
what's the error about? BTW Great link thanks a lot! |
Check that your classpath is set properly, I think I started down the wrong path, because the Impl file is the problem.
|
but shouldn¿t the class be ok if it compiles correctly with javac? isn¿t all bin directory especified?
|
All times are GMT -5. The time now is 08:19 PM. |