JNBridge Logo

JNBridgePro

Bridge anything Java to .NET, Bridge anything .NET to Java

Download

Calling Java from .NET:  Call Java Methods

The proxies for the Java objects in log4j are used exactly as the original objects would be used in Java. We can now use the Java class just as if they were written in .NET!
  • Proxies for the Java classes have namespaces identical to the package names of the original Java classes. Thus, we simply import the namespaces org.apache.log4j, java.lang, and loggerDemo, and afterwards can use the names of the Java classes.
  • Proxies for the Java classes Category, BasicConfigurator, and JavaClass are used in exactly the same way as the original Java classes would have been used.
  • The .NET class DotNetClass calls to the logger object cat will cause messages to be written to the same output as the messages logged by JavaClass.
  • When typing in the calls to the Java objects, Visual Studio’s IntelliSense facility will offer to complete the names of method calls in the same way that it would for calls to .NET objects, and will provide information on number and types of parameters.

After entering the code, build the project to create the executable.

Find out more...