LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 01-27-2004, 11:56 AM   #1
poeta_boy
Member
 
Registered: Oct 2003
Location: Mexico
Distribution: Ubuntu
Posts: 223

Rep: Reputation: 31
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!!!
 
Old 01-27-2004, 12:30 PM   #2
acjt
Member
 
Registered: Dec 2002
Location: Australia
Distribution: Gentoo
Posts: 161

Rep: Reputation: 30
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
 
Old 01-27-2004, 01:13 PM   #3
poeta_boy
Member
 
Registered: Oct 2003
Location: Mexico
Distribution: Ubuntu
Posts: 223

Original Poster
Rep: Reputation: 31
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!

Last edited by poeta_boy; 01-27-2004 at 01:24 PM.
 
Old 01-27-2004, 02:16 PM   #4
acjt
Member
 
Registered: Dec 2002
Location: Australia
Distribution: Gentoo
Posts: 161

Rep: Reputation: 30
Check that your classpath is set properly, I think I started down the wrong path, because the Impl file is the problem.
 
Old 01-27-2004, 02:18 PM   #5
poeta_boy
Member
 
Registered: Oct 2003
Location: Mexico
Distribution: Ubuntu
Posts: 223

Original Poster
Rep: Reputation: 31
but shouldn┐t the class be ok if it compiles correctly with javac? isn┐t all bin directory especified?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
JAVA - RMI - rmic doesn't work Falco Programming 4 10-03-2010 11:37 PM
Java RMI Connection Problem mtest Programming 7 09-01-2005 02:43 PM
Java RMI ClassCastException sherryanee Programming 2 10-19-2004 05:25 PM
Java RMI in Linux?? hiteshmaisheri Linux - Software 0 04-20-2004 10:30 AM
can't run java RMI server DrDan Linux - Networking 0 02-27-2004 08:43 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:02 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration