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.

rmic?

That has been obsolete for ten years (well, over nine and a half anyway). It was made unneccessary in Java 1.5 (Sept 2004). See http://docs.oracle.com/javase/tutorial/rmi/overview.html

Don't waste any more time trying to fix an rmic error - update to the current simpler approach as detailed in that tutorial.

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.

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

And HF Java isn't all that good a book anyway. You get what you pay for...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.