Olexander Haliy
Olexander Haliy

Reputation: 41

Can't complie .class file with rmic , class not file

Well i decided to create RMI but faced with one problem. i put CLASSPATH= (to my jdk) then i decided to make Stub with rmic. I wrote: 1. rmic -classpath "D:\workspace\Rmi.example\bin\rmi\app" AddServer -d D:\workspace

where i got such message: error: File D:\workspace\Rmi.example\bin\rmi\app\AddServer.class does not contai n type AddServer as expected, but type rmi.app.AddServer. Please remove the file , or make sure it appears in the correct subdirectory of the class path. error: Class AddServer not found. 2 errors

Upvotes: 0

Views: 3143

Answers (3)

user207421
user207421

Reputation: 311028

rmic -classpath "D:\workspace\Rmi.example\bin" rmi.app.AddServer -d D:\workspace

BUT: Don't use 'rmic' at all. It hasn't been required for about ten years. Read the preamble to UnicastRemoteObject. Basically, as long as you provide a port number when constructing/exporting your remote objects, even zero, a dynamic stub can be generated instead at runtime.

Upvotes: 1

gparyani
gparyani

Reputation: 1988

You're supposed to run rmic from the base directory where your package starts. For example: rmic -classpath "D:\workspace\Rmi.example\bin\" rmi.app.AddServer -d D:\workspace

Upvotes: 0

Greg Temkin
Greg Temkin

Reputation: 76

I understand your class AppServer is in rmi.app package? Then your classpath must be D:\workspace\Rmi.example\bin, not D:\workspace\Rmi.example\bin\rmi\app

Upvotes: 0

Related Questions