import java.rmi.RemoteException;
import java.util.Properties;
import javax.naming.Context;
import javax.naming.InitialContext;
//import it.html.ejb.session.stateless;
public class Main {
public static void main(String[] args) {
// TODO Auto-generated method stub
}
Properties props = new Properties();
// Bisogna valorizzare alcuni parametri, che rappresentano il
// modo con cui accediamo al JNDI dell'application server
// La classe concreta (importare il package jnpserver.jar)
String lui="org.jnp.interfaces.NamingContextFactory";
String lei="jnp://localhost:1099";
//lui1=lui;
props.put ContextINITIAL_CONTEXT_FACTORY,lui1;
// La url dell'application server e la port a cui risponde JNDI (default)
props.put ContextPROVIDER_URL, lei1;
Context ctx=new Context(props);
ServerTimeHome sth = (ServerTimeHome) PortableRemoteObject.narrow(ctx.lookup(ServerTimeH ome.JNDI_NAME), ServerTimeHome.class);
ServerTime st=(ServerTime) sth.create();
System.out.println("=data e ora: "+st.getTime());
//+Sr.getTime());
/* (non-Java-doc
//java.lang.Object#Object();
*/
public Main() {
super();
}
} ho errore su println syntax error on token "println",= expected after this token uso eclipe; è un esempio tratto dalla lezione 8 di java.html.it java2ee