How to access Java static methods/fields from .NET |
|
Contents
- SYMPTOMS
- CAUSE
- RESOLUTION
SYMPTOMSIf you try to access static methods/fields directly, it complains that an instance is needed for each of them. After making the instance, the methods/fields are still not accessable.
CAUSEThis unfortunately is a limitation of .NET remoting which doesn't support remote static fields/constructors, and hence J-Integra for .NET doesn't neither.
RESOLUTIONYou could create a Java class that exposes the static method as an instance method of another class. This is the current workaround. For example, to solve a static constructor issue, you are going to have to create a "Factory" type class that contains functions that return the static constructors. ie..
Class Factory { public Factory() {} public StaticClass getStaticClass() { return StaticClass.newInstance(); } ... } |
StatusThis does not require any fixes to J-Integra for .NET.
|
|
|
|
No Related Articles Available.
|
|
|
|
No Attachments Available.
|
|
|
|
No Related Links Available.
|
|
|
|
|
|
|
No user comments available for this article.
|
|
|
|
|
|
|