JuggerNET Runtime Library v3.6.54.0  3.6.54.0
Public Member Functions | Properties | List of all members
Codemesh.JuggerNET.IJvmLoader Interface Reference

The interface for explicitly configuring or loading a JVM. More...

Inheritance diagram for Codemesh.JuggerNET.IJvmLoader:
Inheritance graph
[legend]
Collaboration diagram for Codemesh.JuggerNET.IJvmLoader:
Collaboration graph
[legend]

Public Member Functions

void Read (string file)
 Explicitly updates the instance with configuration information from the specified configuration file. More...
 
void Read (string vers, string conf, string reserved0)
 Explicitly updates the instance with configuration information from the registry. More...
 
void Read (string file, string vers, string conf, string reserved0)
 Explicitly updates the instance with configuration information from the specified source. More...
 
IJvm Load ()
 Attempts to load a JVM using the configured settings.Codemesh.JuggerNET.IJvmLoader.Read This method is implemented in terms of the load(bool) method with a default value of true. More...
 
IJvm Load (bool bAcceptPreloaded)
 Attempts to load a JVM using the configured settings. If the argument is true, an already loaded JVM will be accepted. More...
 
void UnloadCleanup (IJvm jvm)
 Performs cleanup behind a recently destroyed JVM. More...
 
- Public Member Functions inherited from Codemesh.JuggerNET.IJvmOptions
void AppendToClassPath (string cproot)
 Append a classpath root to the classpath. A classpath root is a directory or a jarfile or a zipfile. More...
 
void PrependToClassPath (string cproot)
 Prepend a classpath root to the classpath. A classpath root is a directory or a jarfile or a zipfile. More...
 
void AppendToBootClassPath (string cproot)
 Append a classpath root to the configured bootclasspath. A classpath root is a directory or a jarfile or a zipfile. More...
 
void PrependToBootClassPath (string cproot)
 Prepend a classpath root to the configured bootclasspath. A classpath root is a directory or a jarfile or a zipfile. More...
 
void AppendToLibraryPath (string libpathroot)
 Append a directory to the library search path. More...
 
void PrependToLibraryPath (string libpathroot)
 Prepend a directory to the librarypath. More...
 
void AppendToExtensionDirectories (string extdir)
 Appends a directory to the configured extensions directories. More...
 
- Public Member Functions inherited from Codemesh.JuggerNET.IOptions
void SetTraceLevel (TraceFacility fac, TraceLevel level)
 Set the trace level for a trace facility. More...
 
TraceLevel GetTraceLevel (TraceFacility fac)
 Query the trace level for a trace facility. More...
 
void SetTraceFile (string name, int numFilesToRetain)
 Sets both the trace file name and the number of old files to retain in one operation. More...
 

Properties

IJvm JvmIfCreated [get]
 A property giving access to an already created Jvm without creating one. This property allows you to query whether a Jvm has already been loaded via the JvmLoader API. More...
 
string ClassPathAnalysis [get]
 A property that can be used to analyze the classpath. The returned string contains useful cleartext feedback on the correctness of configured classpath roots. More...
 
string ClassesAnalysis [get]
 A property that can be used to analyze the proxy classes. The returned string contains useful cleartext feedback on the availability of Java types for present proxy types. More...
 
string MethodsAndFieldsAnalysis [get]
 A property that can be used to analyze the inner structure of proxy classes. The returned string contains useful cleartext feedback on the availability of Java fields and methods for present proxy type field and method elements. More...
 
- Properties inherited from Codemesh.JuggerNET.IJvmOptions
string AgentLib [set]
 A property that corresponds with the Java5/6 -agentlib option. More...
 
string AgentPath [set]
 A property that corresponds with the Java5/6 -agentpath option. More...
 
string JavaAgent [set]
 A property that corresponds with the Java5/6 -agentpath option. More...
 
string Splash [set]
 A property that corresponds with the Java5/6 -splash option. More...
 
bool COMExceptionMessages [get, set]
 A property governing whether exception type, message, and stack trace are all bundled up in one XML message that is supplied as the exception's Message property. VB6 clients only have easy access to the message and this would provide all necesssary information if set to true. This property is set to false by default. More...
 
DashDOptionType DashDOption [get]
 The property that allows the specification of -D options. More...
 
DashXOptionType DashXOption [get]
 The property that allows the specification of -X options. More...
 
AbortCallback Abort [get, set]
 The callback for JVM abortion. More...
 
ExitCallback Exit [get, set]
 The callback for JVM exit. More...
 
VfprintfCallback Vfprintf [get, set]
 The callback for JVM print statements. More...
 
int JniVersion [get, set]
 The JNI Version number to be used for initialization of the JVM. This is synonymous to the JNILevel property. More...
 
int JNILevel [get, set]
 The JNI Version number to be used for initialization of the JVM. This is synonymous to the JniVersion property. More...
 
bool UseCodemeshSecurityManager [get, set]
 Governs whether a Codemesh SecurityManager is registered instead of the configured one. The Codemesh security manager delegates to the configured one in all but a few cases (the security privileges it needs granted to work). More...
 
bool IgnoreUnrecognized [get, set]
 Governs whether an unrecognized configuration option causes an JVM initialization error. More...
 
int StackSizeInKB [get, set]
 The stack size in KB used for the Java stack. This property is synonymous to the StackSize property. More...
 
int StackSize [get, set]
 The stack size in KB used for the Java stack. This property is synonymous to the StackSizeInKB property. More...
 
int InitialHeapSizeInMB [get, set]
 The initial JVM heap size in MB. This property is synonymous to the InitialHeapSize property. More...
 
int InitialHeapSize [get, set]
 The initial JVM heap size in MB. This property is synonymous to the InitialHeapSizeInMB property. More...
 
int MaximumHeapSizeInMB [get, set]
 The maximum JVM heap size in MB. This property is synonymous to the MaximumHeapSize property. More...
 
int MaximumHeapSize [get, set]
 The maximum JVM heap size in MB. This property is synonymous to the MaximumHeapSizeInMB property. More...
 
string ClassPath [get, set]
 The application classpath configured for the JVM. More...
 
string BootClassPath [get, set]
 The JVMs bootclasspath. More...
 
string AppendBootClassPath [get, set]
 The JVMs append-to-bootclasspath setting. More...
 
string PrependBootClassPath [get, set]
 The JVMs prepend-to-bootclasspath setting. More...
 
string LibraryPath [get, set]
 The application librarypath configured for the JVM. More...
 
string ExtensionDirectories [get, set]
 The extensions directory configured for the JVM. More...
 
string SecurityManager [get, set]
 The name of a Java class which acts as the security manager for the session. More...
 
Verbosity Verbose [get, set]
 The verbosity of the JVM. More...
 
string SecurityPolicy [get, set]
 The name of a file which contains the security policy for the session. More...
 
bool DisableClassGC [get, set]
 Disables class garbage collection if set to true. More...
 
bool EnableClassGC [get, set]
 Enables class garbage collection if set to true. More...
 
bool EnableVerboseGC [get, set]
 Enables verbose garbage collection if set to true. More...
 
bool MixedMode [get, set]
 Enables mixed execution mode if set to true. More...
 
bool InterpretedMode [get, set]
 Enables interpreted execution mode if set to true. More...
 
bool IncrementalGC [get, set]
 
string LogGCFile [get, set]
 
bool BatchMode [get, set]
 
bool Prof [get, set]
 Start the JVM with profiling support enabled if this property is true. More...
 
string Run [get, set]
 Specifies particular runtime settings that are used to configure the debugging or profiling support. More...
 
bool Debug [get, set]
 Start the embedded JVM in debug mode, allowing an external debugger to attach to it. More...
 
bool NoAgent [get, set]
 The Sun classic VM supports both the old sun.tools.debug interface and JPDA, the option "-Xdebug" enables both, but defaults to running the sun.tools.debug agent. The "-Xnoagent" turns this off so that JPDA will work. The HotSpot VM does not have this option. More...
 
bool ReduceSignals [get, set]
 Reduces usage of operating-system signals by Java virtual machine if set to true. More...
 
bool CheckJni [get, set]
 Performs additional validation on JNI calls if set to true. More...
 
bool Future [get, set]
 Performs strict class-file format checks if set to true.
More...
 
- Properties inherited from Codemesh.JuggerNET.IOptions
string JvmPath [get, set]
 The JVM that is to be used in in-process mode. This is the full path to a file which is usually called jvm.dll and is in a subdirectory of the Java Runtime Environment (JRE). More...
 
string DefaultJvmPath [get]
 The JVM that would be selected by the runtime library to be used in in-process mode if no JvmPath is specified explicitly. This is the full path to a file which is usually called jvm.dll and is in a subdirectory of a Java Runtime Environment (JRE). This is a read-only property that allows you to query the choice made by the runtime. More...
 
bool NoshutdownProcessing [get, set]
 Governs whether the application should attempt to perform cleanup in the JVM when shutting down. This defaults to false, but some applications may require setting this property to true if they experience shutdown crashes. More...
 
string TraceFile [get, set]
 A file into which trace messages are written. If not specified, all tracing output is going to stdout. More...
 
int TraceFileCount [get, set]
 The number of old trace files to retain. More...
 
TraceCallback TraceMethod [get, set]
 Allows you to register a custom tracing method. More...
 
bool Remote [get, set]
 Specifies whether to use in-process or out-of-process runtime mode. If you use a value of true here, you will need to configure at least the IRemoteOptions.ConnectionString property. More...
 
int MilliSecondsToForcedGC [get, set]
 Specifies the number of milliseconds between forced garbage collections to alleviate memory pressure on the Java heap. The default value is 1000. A value of 0 disables forced garbage collection. More...
 
int NumObjectsToForcedGC [get, set]
 Specifies the number of prxoy objects that need to be instantiated before a forced garbage collection takes place to alleviate memory pressure on the Java heap. The default value is 10,000. A value of 0 disables forced garbage collection. More...
 
string SkipTypeAnalysisForTheseAssemblies [get, set]
 Specifies semicolon-separated list of assembly name fragments that refer to assemblies that should be skipped during proxy type analysis. More...
 
string PerformTypeAnalysisForTheseAssemblies [get, set]
 Specifies semicolon-separated list of assembly name fragments that refer to assemblies that are the only assemblies that are to be analyzed for the presence of proxy types. More...
 
ExceptionHandlerCallback ExceptionHandler [get, set]
 Specifies the callback that you can use to customize the type of exception that is thrown by the JuggerNET framework. More...
 
- Properties inherited from Codemesh.JuggerNET.IRemoteOptions
bool JniFallback [get, set]
 Attempts to fall back to JNI in-proces mode if no connection with a shared JVM can be established if this property is true. More...
 
string MainClass [get, set]
 Not yet used. More...
 
string Authentication [get, set]
 Not yet used. More...
 
string Encryption [get, set]
 Not yet used. More...
 
string Connection [get, set]
 Specifies the connection settings for a shared JVM. More...
 

Detailed Description

The interface for explicitly configuring or loading a JVM.

This interface declares the basic API for explicitly configuring the way the .NET process tries to hook up with a Java virtual machine. Remember that we don't translate Java to .NET, we bridge it. This means that at runtime your .NET types need to be able to find their corresponding Java types. Even though there are several ways you can hide the configuration details from application programmers, we recommend that you have one well defined point in your application where you attempt to connect to the Java side, detect configuration errors, and handle any problems that might have occured.

This will usually look something like this:

IJvmLoader loader = JvmLoader.GetJvmLoader();
IJvm jvm = null;
try
{
if( loader.JvmPath == null )
loader.JvmPath = @"..\jre\bin\client\jvm.dll";
loader.AppendToClassPath( @"c:\temp\myclasses.jar" );
if( loader.MaximumHeapSize < 256 )
loader.MaximumHeapSize = 256;
jvm = loader.Load();
}
catch( System.Exception se )
{
Console.WriteLine( "JVM couldn't be loaded: {0}", se.ToString() );
}
try
{
if( jvm != null )
Class.ForName( "com.myfirm.util.MyType" );
}
catch( System.Exception se )
{
Console.WriteLine( "Missing jarfile: {0}", se.Message );
}

In this example, we acquire a loader instance and configure some Java options. Notice how we use a pattern which allows the setting of default values via different configuration mechanisms. If a JvmPath is already configured, we don't reconfigure it; if a maximum Java heapsize of more than 256MB is already configured, we don't override it. Once everything is configured, we attempt to load the JVM and handle any errors that might occur at that point. If we succeeded, we attempt to load a class that we know to be required. This is a great sanity check to perform at runtime because hard-to-diagnose classpath misconfigurations (or missing jarfiles) get caught early on and don't turn into bigger problems later on.

The IJvmLoader interface aggregates the IJvmOptions, IOptions, and IRemoteOptions interfaces, which all provide configuration properties for different purposes.

Member Function Documentation

◆ Load() [1/2]

IJvm Codemesh.JuggerNET.IJvmLoader.Load ( )

Attempts to load a JVM using the configured settings.Codemesh.JuggerNET.IJvmLoader.Read This method is implemented in terms of the load(bool) method with a default value of true.

Returns
a reference to a JVM if successful.

Implemented in Codemesh.JuggerNET.JvmLoader.

Referenced by Codemesh.JuggerNET.JuggerNETProxyObject.JuggerNETProxyObject(), and Codemesh.JuggerNET.LifeCycleManager.keep().

◆ Load() [2/2]

IJvm Codemesh.JuggerNET.IJvmLoader.Load ( bool  bAcceptPreloaded)

Attempts to load a JVM using the configured settings. If the argument is true, an already loaded JVM will be accepted.

Parameters
bAcceptPreloaded
Returns
a reference to a JVM if successful.

Implemented in Codemesh.JuggerNET.JvmLoader.

◆ Read() [1/3]

void Codemesh.JuggerNET.IJvmLoader.Read ( string  file)

Explicitly updates the instance with configuration information from the specified configuration file.

Parameters
filethe configuration file to be used.

Implemented in Codemesh.JuggerNET.JvmLoader.

Referenced by Codemesh.JuggerNET.JvmLoader.GetJvmLoader().

◆ Read() [2/3]

void Codemesh.JuggerNET.IJvmLoader.Read ( string  file,
string  vers,
string  conf,
string  reserved0 
)

Explicitly updates the instance with configuration information from the specified source.

Parameters
filethe configuration file to be used. May be null to represent the registry.
versthe version of the named configuration to be used. May be null.
confthe name of the named configuration to be used. May be null.
reserved0Must be null.

Implemented in Codemesh.JuggerNET.JvmLoader.

◆ Read() [3/3]

void Codemesh.JuggerNET.IJvmLoader.Read ( string  vers,
string  conf,
string  reserved0 
)

Explicitly updates the instance with configuration information from the registry.

Parameters
versthe version of the named configuration to be used. May be null.
confthe name of the named configuration to be used. May be null.
reserved0Must be null.

Implemented in Codemesh.JuggerNET.JvmLoader.

◆ UnloadCleanup()

void Codemesh.JuggerNET.IJvmLoader.UnloadCleanup ( IJvm  jvm)

Performs cleanup behind a recently destroyed JVM.

Parameters
jvmThe JVM that was just unloaded.

Implemented in Codemesh.JuggerNET.JvmLoader.

Referenced by Codemesh.JuggerNET.Jvm.Destroy().

Property Documentation

◆ ClassesAnalysis

string Codemesh.JuggerNET.IJvmLoader.ClassesAnalysis
get

A property that can be used to analyze the proxy classes. The returned string contains useful cleartext feedback on the availability of Java types for present proxy types.

The text returned by this property can be a great help during the debugging of configuration problems. We have wasted countless hours trying to figure out an application crash that in the end was due to an innocuous misspelling in a configured classpath root. Be careful with this property because it will cause the loading of all Java classes that are known as proxy types. This is different from the normal mode of operations, where a Java class is only loaded when it is about to be used for the first time.

◆ ClassPathAnalysis

string Codemesh.JuggerNET.IJvmLoader.ClassPathAnalysis
get

A property that can be used to analyze the classpath. The returned string contains useful cleartext feedback on the correctness of configured classpath roots.

The text returned by this property can be a great help during the debugging of configuration problems. We have wasted countless hours trying to figure out an application crash that in the end was due to an innocuous misspelling in a configured classpath root.

◆ JvmIfCreated

IJvm Codemesh.JuggerNET.IJvmLoader.JvmIfCreated
get

A property giving access to an already created Jvm without creating one. This property allows you to query whether a Jvm has already been loaded via the JvmLoader API.

Referenced by Codemesh.JuggerNET.JuggerNETProxyObject.JuggerNETProxyObject().

◆ MethodsAndFieldsAnalysis

string Codemesh.JuggerNET.IJvmLoader.MethodsAndFieldsAnalysis
get

A property that can be used to analyze the inner structure of proxy classes. The returned string contains useful cleartext feedback on the availability of Java fields and methods for present proxy type field and method elements.


The documentation for this interface was generated from the following file:

Copyright (c) 1999-2020 by Codemesh, Inc., ALL RIGHTS RESERVED.