1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
| /*
* Main.java
*
* Created on 14 août 2006, 13:17
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
package javaapplication3;
import demo.ejb3.calculatrice.CalculatriceRemote;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.rmi.PortableRemoteObject;
/**
*
* @author Administrateur
*/
public class Main {
/** Creates a new instance of Main */
public Main() {
}
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
System.out.println("additionner");
InitialContext ctx;
try {
ctx = new InitialContext();
Object ref = ctx.lookup("CalculatriceRemote");
CalculatriceRemote calc = (CalculatriceRemote)PortableRemoteObject.narrow(ref,CalculatriceRemote.class);
System.out.println(calc.additionner(2,4));
} catch (NamingException ex) {
System.err.println("Error");
}
}
} |
Partager