Client and server don't have to be in the same package! They just both need to depend on the same package, which contains the shared interface.
In the linked question, there was a problem with interfaces: OP declared two interfaces with the same name in two separate packages. That is why casting failed and 6F00
status was thrown.
How to use Shareable
interface:
1.Declare your shared interface public
in your server-side package:
package com.test.mypackage.a;
public interface SharedObject extends Shareable {
public void foo();
}
2.Use the interface in your client code:
package com.test.mypackage.b;
import com.test.mypackage.a.SharedObject;
...
SharedObject obj = (SharedObject) JCSystem.getAppletShareableInterfaceObject(svrAid, (byte)0);
- Use your server applet as a library when building your client applet.
- Load your server applet
cap
file first.
- Then load your client applet
cap
file.