The Static Library

The static is straight forward to use. 
    • Name : JVMWrapper.lib
    • Version : 1.0.0.1
        
         You can download it at the bottom of the page.

It has 3 functions exported: 

extern "C" __declspec(dllexport) void printDLLInfo();

extern "C" __declspec(dllexport) int launchJVMS(JVMLauncherOptions options);

extern "C" __declspec(dllexport) int launchJVM(
        bool redirectOutput,
bool verboseJNI,
bool disableJIT,
bool useServerJVM,
char * pathStdOutputLog,
char * pathStdErrOutputLog,
char * pathJVM,
char * classPath,
char * JVMFlags,
char * JVMLDPaths,
char * mainClass,
char * programArguments);

Information about the JVMLauncherOptions structure, in case you want to use it, it is contained on the header file

These are the parameters explained: 

  1. bool redirectOutput : If you want to redirect standard and error output to log files. If true, you need to set pathStdOutputLog and pathStdErrOutputLog.
  2. bool verboseJNI : Sets verbose execution of the JVM, for debugging / informational purposes.
  3. bool disableJIT : Disables Just in Time capabilities of the JVM. 
  4. bool useServerJVM : Sets the execution to use jvm.dll server dll, on the JVM, you need the JDK installed.
  5. char * pathStdOutputLog : Path desired to dump the standard output. 
  6. char * pathStdErrOutputLog : Path desired to dump the error output. 
  7. char * pathJVM : Path to the JVM to be used. 
  8. char * classPath : The classpath to be used, separated by the ; char.
  9. char * JVMFlags : The JVM flags desired to use, separated by the ; char ( -Xms512M;-Xmx1024M and so on).
  10. char * JVMLDPaths : If you want to set LD_LIBRARY path, in case you use native Win32 / C / C++ from your java program.
  11. char * mainClass : The java main class you want to run. Please use / instead of . (johannasoft/testClass instead of joahannasoft.testClass).
  12. char * programArguments : your java class main method desired parameters, separated by ; (arg1;arg2 and so on).
Example snipplet, using the JVMLauncherOptions structure: 

        JVMLauncherOptions o; 
o.classPath="c:\\temp\\SimpleTest.jar"; 
o.disableJIT=false; 
o.JVMFlags="-Xms128M;-Xmx246M"; 
o.JVMLDPaths="C:\\Program Files\\Java\\jdk1.7.0_21\\jre\\bin"; 
o.mainClass="johannasoft/jvmwrapper/test/SimpleTest"; 
o.pathJVM="C:\\Program Files\\Java\\jdk1.7.0_21";
o.useServerJVM=true; 
o.verboseJNI=true; 
o.programArguments="arg1;arg2;arg3";
o.redirectOutput=true; 
o.pathStdOutputLog="c:\\temp\\out.txt";
o.pathStdErrOutputLog="c:\\temp\\err.txt";


ċ
JVMWrapperStatic-1.0.0.1.zip
(280k)
Johannasoft Software,
26 jun. 2013 1:06