File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

in rmi Its necessary to manually copy a Class file for remote interface in client directory?

 
dashang trivedi
Greenhorn
Posts: 26
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Its possible to load class dynamically ...from any other location...
how its done......
 
Mohamed Jeleel
Greenhorn
Posts: 18
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
through RMI.

It will do loading classes dymanically. It needs only the class objects to be loaded.
 
dashang trivedi
Greenhorn
Posts: 26
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In serever directory

three file
calc.java(interface)
calcimpl.java
calcserver.java



In client directory......

public class CalcClient
{
public static void main(String args[])throws RemoteException,NamingException
{




System.setProperty("java.security.policy","client.policy");
System.setSecurityManager(new SecurityManager());
Context nc=new InitialContext();

try
{

Calc c = (Calc)nc.lookup("rmi://localhost/Calc_Service");
System.out.println("3");
System.out.println("addition-->"+ c.add(10,10));
System.out.println("Subtraction-->"+ c.sub(5,6));
System.out.println("Multiplication-->"+ c.mul(5,3));
System.out.println("Division-->"+ c.div(10,5));
}
catch(Exception e)
{
System.out.println("Error" + e );
}
}


}

it will give Exception class not found.....
If i manually copy Calc.class file in client directory....then program success fully run...........
so any body know HOW THE DYNAMIC DOWNLOADING is done.......
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic