Name | Date | Size | |
---|---|---|---|
.. | 2013-05-16 00:04:22 | 4 | |
invoked.cs | 2013-05-16 00:04:22 | 1.7 KiB | |
invoker.cpp | 2013-05-16 00:04:22 | 5.3 KiB | |
invoker.h | 2013-05-16 00:04:22 | 2.3 KiB | |
invoker.java | 2013-05-16 00:04:22 | 2.5 KiB | |
invokerExp.h | 2013-05-16 00:04:22 | 2.1 KiB | |
Makefile | 2013-05-16 00:04:22 | 1.9 KiB | |
README.txt | 2013-05-16 00:04:22 | 1.6 KiB |
README.txt
This sample provides C# "Hello World" program that is invoked
from Java application in the same process.
There is no way to invoke .NET methods from Java classes directly,
it is necessary to use native code level.
The sample contains C++ library that can invoke any .NET program by mscorlib library.
Using the JNI the Java application invokes the C# "Hello World".
The sample contains the following files:
Makefile - make file
README.txt - this readme
invoked.cs - the invoked HelloWorld Java program
invoker.java - C# invoker application
invoker.cpp - C++ wrapper
invokerExp.h - wrapper library exports
invoker.h - javah generated file with the native method definition
After the success making the following files are produced:
invoked.exe - the executable HelloWorld .NET program
invoker.class - the compiled Java class that invokes the .NET program
invoker.dll - the wrapper library
The following environment needs to be set for the correct sample
build and execution:
INCLUDE must contain the paths to:
1. MS Visual C++ standard include
2. .NET SDK include
3. Java includes
Example: %MSDEV%/VC98/Include;%DOTNET%/Include;%JAVA_HOME%/include;%JAVA_HOME%/include/win32
LIB must contain the paths to:
1. MS Visual C++ standard libraries
2. .NET SDK libraries
Example: %MSDEV%/VC98/Lib;%DOTNET%/Lib
PATH must contain the paths to:
1. MS Visual C++ standard bin
2. MS Dev common bin
3. .NET SDK libraries
4. Java bin
Example: %MSDEV%/VC98/Bin;%MSDEV%/Common/MSDev98/Bin;%DOTNET%/Lib;%JAVA_HOME%/bin;%PATH%
To run the sample please do:
java invoker invoked.exe
--Dmitry Ryashchentsev