when i try to compile my server i get the following errors
D:\JAVA_P~1\SIM PLE~1>javac -classpath . PhoneDirServer. java
PhoneDirServer. java:6: package PhoneDirectory does not exist
import PhoneDirectory. PhoneDirImpl;
^
.\PhoneDirImpl. java:34: class, interface, or enum expected
}
^
.\PhoneDirImpl. java:12: cannot find symbol
symbol: class PhoneDirInterfa ce
implements PhoneDirInterfa ce {
^
PhoneDirServer. java:29: cannot access PhoneDirImpl
bad class file: .\PhoneDirImpl. java
file does not contain class PhoneDirImpl
Please remove or make sure it appears in the correct subdirectory of the classpa
th.
PhoneDirImpl myObject = new PhoneDirImpl();
^
4 errors
here is my server code
they are all in the same directory ..
PhoneDirImpl.ja va
PhoneDirInterfa ce.java
PhoneDirServer. java
D:\JAVA_P~1\SIM PLE~1>javac -classpath . PhoneDirServer. java
PhoneDirServer. java:6: package PhoneDirectory does not exist
import PhoneDirectory. PhoneDirImpl;
^
.\PhoneDirImpl. java:34: class, interface, or enum expected
}
^
.\PhoneDirImpl. java:12: cannot find symbol
symbol: class PhoneDirInterfa ce
implements PhoneDirInterfa ce {
^
PhoneDirServer. java:29: cannot access PhoneDirImpl
bad class file: .\PhoneDirImpl. java
file does not contain class PhoneDirImpl
Please remove or make sure it appears in the correct subdirectory of the classpa
th.
PhoneDirImpl myObject = new PhoneDirImpl();
^
4 errors
here is my server code
Code:
import java.util.Properties;
import javax.naming.InitialContext;
import javax.rmi.PortableRemoteObject;
import PhoneDirectory.PhoneDirImpl;
/**
* Creates a Server and binds the RMI Servant with the IIOP Registry
*
*
*
*/
public class PhoneDirServer {
static final String CONTEXT_NAME = "java.naming.factory.initial";
static final String IIOP_STRING = "com.sun.jndi.cosnaming.CNCtxFactory";
static final String URL_NAME = "java.naming.provider.url";
static final String IIOP_URL_STRING = "iiop://localhost:1000";
/**
* Entry Point to this application
*/
public static void main(String[] args) {
try {
// Create the Object
PhoneDirImpl myObject = new PhoneDirImpl();
// Create the IIOP Initial Context
Properties iiopProperties = new Properties();
iiopProperties.put( PhoneDirServer.CONTEXT_NAME,
PhoneDirServer.IIOP_STRING );
iiopProperties.put( PhoneDirServer.URL_NAME,
PhoneDirServer.IIOP_URL_STRING );
InitialContext iiopContext = new InitialContext( iiopProperties );
// Bind the object to the IIOP registry
iiopContext.rebind( "Phone Directory", myObject );
System.out.println( "Hello from server, ready for action..." );
}
catch ( Exception exception ) {
exception.printStackTrace ();
}
}
}
PhoneDirImpl.ja va
PhoneDirInterfa ce.java
PhoneDirServer. java
Comment