Tried to run ServiceServerImpl.class with rmic and got this error. Below is the command prompt text pasting.

"C:\Program Files\Java\jdk1.7.0_21\bin>rmic.exe ServiceServerImpl

error: File .\ServiceServerImpl.class does not contain type ServiceServerImpl as
expected, but type serviceserver.ServiceServerImpl. Please remove the file, or
make sure it appears in the correct subdirectory of the class path.
error: Class ServiceServerImpl not found.
2 errors "

Here is the source code of the class file. Using Windows 8. I copied the .class file to the rmic.exe 's location later. didn't work either way. It is in a package called "serviceserver"

package serviceserver; 

import java.rmi.*; 
import java.rmi.server.*; 
import java.util.*; 


public class ServiceServerImpl extends UnicastRemoteObject implements ServiceServer 
{ 
HashMap serviceList; 

@Override 
public Object[] getServiceList() throws RemoteException 
{ 
System.out.println("in remote"); 
return serviceList.keySet().toArray(); 
} 

public ServiceServerImpl() throws RemoteException 
{ 
setUpServices(); 
} 

thanks
Update : didn't paste the whole source code here. Stuff is missing form the bottom.

really? I was doing this book "head first java (2005)" and this was an example from it.

That's the problem with books! Your 9 year-old book still contains info from 10 years ago.
Don't take my word for it... check out Oracle's own on-line up-to-date tutorials on how to do RMI.

ps: Java 5 (A.K.A. 1.5) was a massive upgrade to the language. By working with materials from before 1.5 you are not really learning modern Java. The Head First books are highly recommended, butyou must have the very latest editions.

Edited 2 Years Ago by JamesCherrill

ok. Thanks! I will read that one and try to do like that.....

Edited 2 Years Ago by silvercats: didn't work

This article has been dead for over six months. Start a new discussion instead.