J. Duke | 319a3b9 | 2007-12-01 00:00:00 +0000 | [diff] [blame^] | 1 | This sample provides Java "Hello World" program that is invoked
|
| 2 | from C# application in the same process.
|
| 3 |
|
| 4 | The problem of direct call of the JVM API from CLR applications
|
| 5 | by PInvoke interface is the JVM API functions do not have static
|
| 6 | adresses, they need to be got by JNI_CreateJavaVM() call.
|
| 7 | The sample contains C++ libraty that wraps JVM API calls by the
|
| 8 | static functions that are called from the C# application by
|
| 9 | PInvoke interface.
|
| 10 |
|
| 11 | The sample contains the following files:
|
| 12 |
|
| 13 | Makefile - make file
|
| 14 | README.txt - this readme
|
| 15 | invoked.java - the invoked HelloWorld Java program
|
| 16 | invoker.cs - C# invoker application
|
| 17 | jinvoker.cpp - C++ wrapper
|
| 18 | jinvokerExp.h - wrapper library exports
|
| 19 |
|
| 20 | After the success making the following files are produced:
|
| 21 |
|
| 22 | invoked.class - the compiled HelloWorld class
|
| 23 | invoker.exe - the executable .NET program that invokes Java
|
| 24 | jinvoker.dll - the wrapper library
|
| 25 |
|
| 26 | The following environment needs to be set for the correct sample
|
| 27 | build and execution:
|
| 28 |
|
| 29 | INCLUDE must contain the paths to:
|
| 30 | 1. MS Visual C++ standard include
|
| 31 | 2. .NET SDK include
|
| 32 | 3. Java includes
|
| 33 | Example: %MSDEV%/VC98/Include;%DOTNET%/Include;%JAVA_HOME%/include;%JAVA_HOME%/include/win32
|
| 34 |
|
| 35 | LIB must contain the paths to:
|
| 36 | 1. MS Visual C++ standard libraries
|
| 37 | 2. .NET SDK libraries
|
| 38 | 3. jvm.dll
|
| 39 | Example: %MSDEV%/VC98/Lib;%DOTNET%/Lib;%JAVA_HOME%/jre/bin/client
|
| 40 |
|
| 41 | PATH must contain the paths to:
|
| 42 | 1. MS Visual C++ standard bin
|
| 43 | 2. MS Dev common bin
|
| 44 | 3. .NET SDK libraries
|
| 45 | 4. Java bin
|
| 46 | 5. jvm.dll
|
| 47 | Example: %MSDEV%/VC98/Bin;%MSDEV%/Common/MSDev98/Bin;%DOTNET%/Lib;%JAVA_HOME%/bin;%JAVA_HOME%/jre/bin/client;%PATH%
|
| 48 |
|
| 49 | To run the sample please do:
|
| 50 |
|
| 51 | invoker.exe invoked
|
| 52 |
|
| 53 |
|
| 54 | --Dmitry Ryashchentsev
|