Home : How to access Java static methods/fields from .NET
Q140149 - HOWTO: How to access Java static methods/fields from .NET

How to access Java static methods/fields from .NET

 

Contents

  1. SYMPTOMS
  2. CAUSE
  3. RESOLUTION

SYMPTOMS

If 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.

CAUSE

This unfortunately is a limitation of .NET remoting which doesn't support remote static fields/constructors, and hence J-Integra for .NET doesn't neither.

RESOLUTION

You 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();
  }
  ...
}

Status

This does not require any fixes to J-Integra for .NET.
Related Articles
No Related Articles Available.

Article Attachments
No Attachments Available.

Related External Links
No Related Links Available.
Help us improve this article...
What did you think of this article?

poor 
1
2
3
4
5
6
7
8
9
10

 excellent
Tell us why you rated the content this way. (optional)
 
Approved Comments...
No user comments available for this article.
Created on 6/23/2006.
Last Modified on 7/10/2006.
Last Modified by No Author Name Available!.
Article has been viewed 15363 times.
Rated 4 out of 10 based on 7 votes.
Print Article
Email Article