|
Now that the proxies have been generated, we can use them to access Java
classes from .NET.
Launch Visual Studio (or use
the .NET SDK), and create a new C# console application project. Add references
to the assemblies logging.dll (the one just generated) and
jnbshare.dll (distributed with JNBridgePro). Next, add a new class
and enter the C# code on the left.
Note that strings passed to the info() and debug()
methods need to be wrapped in a java.lang.JavaString() object.
This is because info() and debug() both expect a
parameter of class java.lang.Object, and the .NET string is not
a subclass of java.lang.Object, while
java.lang.JavaString is. See the JNBridgePro User’s Guide for
more details.
|