LibreOffice Module jvmfwk (master) 1
|
@HTML More...
#include <sal/config.h>
#include <memory>
#include <vector>
#include <jvmfwk/jvmfwkdllapi.hxx>
#include <rtl/byteseq.hxx>
#include <rtl/ustring.hxx>
#include <jni.h>
Go to the source code of this file.
Classes | |
struct | JavaInfo |
an instance of this struct represents an installation of a Java Runtime Environment (JRE). More... | |
Macros | |
#define | JFW_REQUIRE_NEEDRESTART 0x1l |
indicates that there must be an environment set up before the Java process runs. More... | |
Enumerations | |
enum | javaFrameworkError { JFW_E_NONE , JFW_E_ERROR , JFW_E_NO_SELECT , JFW_E_INVALID_SETTINGS , JFW_E_NEED_RESTART , JFW_E_RUNNING_JVM , JFW_E_JAVA_DISABLED , JFW_E_NOT_RECOGNIZED , JFW_E_FAILED_VERSION , JFW_E_NO_JAVA_FOUND , JFW_E_VM_CREATION_FAILED , JFW_E_CONFIGURATION , JFW_E_DIRECT_MODE } |
error codes which are returned by functions of this API. More... | |
Functions | |
JVMFWK_DLLPUBLIC bool | jfw_areEqualJavaInfo (JavaInfo const *pInfoA, JavaInfo const *pInfoB) |
compares two JavaInfo objects for equality. More... | |
JVMFWK_DLLPUBLIC bool | jfw_isVMRunning () |
determines if a Java Virtual Machine is already running. More... | |
JVMFWK_DLLPUBLIC javaFrameworkError | jfw_findAndSelectJRE (std::unique_ptr< JavaInfo > *pInfo) |
detects a suitable JRE and configures the framework to use it. More... | |
JVMFWK_DLLPUBLIC javaFrameworkError | jfw_findAllJREs (std::vector< std::unique_ptr< JavaInfo > > *parInfo) |
provides information about all available JRE installations. More... | |
JVMFWK_DLLPUBLIC std::vector< OUString > | jfw_convertUserPathList (OUString const &sUserPath) |
Convert colon-separated userClassPath which might contain bootstrap variables (which also might contain colons) to a list of classPaths, keeping bootstrap variables intact. More... | |
JVMFWK_DLLPUBLIC javaFrameworkError | jfw_getJavaInfoByPath (OUString const &pPath, std::unique_ptr< JavaInfo > *ppInfo) |
determines if a path points to a Java installation. More... | |
JVMFWK_DLLPUBLIC javaFrameworkError | jfw_startVM (JavaInfo const *pInfo, std::vector< OUString > const &arOptions, JavaVM **ppVM, JNIEnv **ppEnv) |
starts a Java Virtual Machine (JVM). More... | |
JVMFWK_DLLPUBLIC javaFrameworkError | jfw_setSelectedJRE (JavaInfo const *pInfo) |
determines the JRE that is to be used. More... | |
JVMFWK_DLLPUBLIC javaFrameworkError | jfw_getSelectedJRE (std::unique_ptr< JavaInfo > *ppInfo) |
provides information about the JRE that is to be used. More... | |
JVMFWK_DLLPUBLIC javaFrameworkError | jfw_setEnabled (bool bEnabled) |
determines if Java can be used. More... | |
JVMFWK_DLLPUBLIC javaFrameworkError | jfw_getEnabled (bool *pbEnabled) |
provides the information if Java can be used. More... | |
JVMFWK_DLLPUBLIC javaFrameworkError | jfw_setVMParameters (std::vector< OUString > const &arArgs) |
determines parameters which are passed to VM during its creation. More... | |
JVMFWK_DLLPUBLIC javaFrameworkError | jfw_getVMParameters (std::vector< OUString > *parParameters) |
obtains the currently used start parameters. More... | |
JVMFWK_DLLPUBLIC javaFrameworkError | jfw_setUserClassPath (OUString const &pCP) |
sets the user class path. More... | |
JVMFWK_DLLPUBLIC javaFrameworkError | jfw_getUserClassPath (OUString *ppCP) |
provides the value of the current user class path. More... | |
JVMFWK_DLLPUBLIC javaFrameworkError | jfw_addJRELocation (OUString const &sLocation) |
saves the location of a JRE. More... | |
JVMFWK_DLLPUBLIC javaFrameworkError | jfw_existJRE (const JavaInfo *pInfo, bool *exist) |
checks if the installation of the jre still exists. More... | |
JVMFWK_DLLPUBLIC void | jfw_lock () |
locks this API so that it cannot be used by other threads. More... | |
JVMFWK_DLLPUBLIC void | jfw_unlock () |
unlocks this API. More... | |
@HTML
This library can operate in two modes, application mode and direct mode.
In application mode the Java related settings are stored in files. There are currently three files which need to be accessed. They are determined by bootstrap parameters:
The values for these parameters must be file URLs and include the file name, for example:
file:///d:/MyApp/javavendors.xml
All files are XML files and must have the extension .xml.
Modifying the shared settings is currently not supported by the framework. To provide Java settings for all users one can run OOo and change the settings in the options dialog. These settings are made persistent in the UNO_JAVA_JFW_USER_DATA. The file can then be copied into the base installation. Other users will use automatically these data but can override the settings in the options dialog. This mechanism may change in the future.
If shared Java settings are not supported by an application then it is not necessary to specify the bootstrap parameter UNO_JAVA_JFW_SHARED_DATA
.
Setting the class path used by a Java VM should not be necessary. The locations of Jar files should be known by a class loader. If a jar file depends on another jar file then it can be referenced in the manifest file of the first jar. However, a user may add jars to the class path by using this API. If it becomes necessary to add files to the class path which is to be used by all users then one can use the bootstrap parameter UNO_JAVA_JFW_CLASSPATH_URLS. The value contains of file URLs which must be separated by spaces.
The direct mode is intended for a scenario where no configuration files are available and a Java VM shall be run. That is, the files containing the user and shared settings are not specified by the bootstrap parameters UNO_JAVA_JFW_SHARED_DATA and UNO_JAVA_JFW_USER_DATA. For example, tools, such as regcomp, may use this framework in a build environment. Then one would want to use settings which have been specified by the build environment. The framework would automatically use the current settings when they change in the environment.
Here are examples how regcomp could be invoked using bootstrap parameters:
regcomp -env:UNO_JAVA_JFW_JREHOME=file:///d:/j2re1.4.2 -env:"UNO_JAVA_JFW_CLASSPATH=d:\solver\bin\classes.jar;d:\solver\bin\libreoffice.jar" -register...
If UNO_JAVA_JFW_VENDOR_SETTINGS is not set then a plugin library must be specified. For example:
regcomp -env:UNO_JAVA_JFW_JREHOME=file:///d:/j2re1.4.2 -env:"UNO_JAVA_JFW_CLASSPATH=d:\solver\bin\classes.jar;d:\solver\bin\libreoffice.jar" -register...
Additional parameters for the Java VM can be provided. For every parameter a separate bootstrap parameter must be specified. The names are UNO_JAVA_JFW_PARAMETER_X
, where X is 1,2, .. n. For example:
regcomp -env:UNO_JAVA_JFW_PARAMETER_1=-Xdebug -env:UNO_JAVA_JFW_PARAMETER_2=-Xrunjdwp:transport=dt_socket,server=y,address=8100 -env:UNO_JAVA_JFW_JREHOME=file:///d:/j2re1.4.2 -env:"UNO_JAVA_JFW_CLASSPATH=d:\solver\bin\classes.jar;d:\solver\bin\libreoffice.jar" -register...
Here is a complete list of the bootstrap parameter for the direct mode:
A note about bootstrap parameters. The implementation of the bootstrap parameter mechanism interprets the characters '\', '$', '{', '}' as escape characters. That's why the Windows path contain double back-slashes. One should also take into account that a console may have also special escape characters.
The default mode is application mode. If at least one bootstrap parameter for the direct mode is provided then direct mode is used.
All settings made by this API are done for the current user if not mentioned differently.
Definition in file include/jvmfwk/framework.hxx.
#define JFW_REQUIRE_NEEDRESTART 0x1l |
indicates that there must be an environment set up before the Java process runs.
Therefore, when a Java is selected in OO then the office must be restarted, so that the changes can take effect.
Definition at line 174 of file include/jvmfwk/framework.hxx.
enum javaFrameworkError |
error codes which are returned by functions of this API.
Definition at line 178 of file include/jvmfwk/framework.hxx.
JVMFWK_DLLPUBLIC javaFrameworkError jfw_addJRELocation | ( | OUString const & | sLocation | ) |
saves the location of a JRE.
When jfw_findAllJREs
is called then the paths added by this function are evaluated. If the location still represents a JRE then a JavaInfo
object is created which is returned along with all other JavaInfo
objects by jfw_findAllJREs
. If the location cannot be recognized then the location string is ignored.
A validation if sLocation
points to a JRE is not performed. To do that one has to use jfw_getJavaInfoByPath
.
Adding a path that is already stored causes no error.
sLocation | [in] file URL to a directory which contains a JRE. |
Definition at line 753 of file framework.cxx.
References jfw::NodeJava::addJRELocation(), jfw::FrameworkException::errorCode, jfw::FwkMutex(), jfw::getMode(), JFW_E_DIRECT_MODE, JFW_E_NONE, jfw::JFW_MODE_DIRECT, jfw::NodeJava::load(), jfw::FrameworkException::message, SAL_WARN, jfw::NodeJava::USER, and jfw::NodeJava::write().
JVMFWK_DLLPUBLIC bool jfw_areEqualJavaInfo | ( | JavaInfo const * | pInfoA, |
JavaInfo const * | pInfoB | ||
) |
compares two JavaInfo
objects for equality.
Two JavaInfo
objects are said to be equal if the contained members of the first JavaInfo
are equal to their counterparts in the second JavaInfo
object. The equality of the OUString
members is determined by operator ==
. Similarly the equality of the rtl::ByteSequence
is also determined by a comparison function (see rtl::ByteSequence::operator ==
).
Both argument pointers must be valid.
pInfoA | the first argument. |
pInfoB | the second argument which is compared with the first. |
Definition at line 480 of file framework.cxx.
References JavaInfo::arVendorData, JavaInfo::nRequirements, JavaInfo::sLocation, JavaInfo::sVendor, and JavaInfo::sVersion.
Referenced by jfw_setSelectedJRE().
JVMFWK_DLLPUBLIC std::vector< OUString > jfw_convertUserPathList | ( | OUString const & | sUserPath | ) |
Convert colon-separated userClassPath which might contain bootstrap variables (which also might contain colons) to a list of classPaths, keeping bootstrap variables intact.
FIXME: Nested or multiple occurrences of ${...:...:...} are currently not supported.
sUserPath | colon-separated string of user classpaths |
Definition at line 136 of file framework.cxx.
References result, and SAL_PATHSEPARATOR.
Referenced by jfw_startVM().
JVMFWK_DLLPUBLIC javaFrameworkError jfw_existJRE | ( | const JavaInfo * | pInfo, |
bool * | exist | ||
) |
checks if the installation of the jre still exists.
This function checks if the JRE described by pInfo still exists. The check must be very quick because it is called by javaldx (Linux, Solaris) at start up.
pInfo | [in] the JavaInfo object with information about the JRE. |
pp_exist | [out] the parameter is set to either true or false. The value is only valid if the function returns JFW_E_NONE. |
Definition at line 776 of file framework.cxx.
References Error, JFW_E_ERROR, JFW_E_NONE, jfw_plugin_existJRE(), and NONE.
JVMFWK_DLLPUBLIC javaFrameworkError jfw_findAllJREs | ( | std::vector< std::unique_ptr< JavaInfo > > * | parInfo | ) |
provides information about all available JRE installations.
The function determines dynamically what JREs are available. It uses the plug-in libraries to provide lists of available JavaInfo
objects where each object represents a JRE (see vendorplugin.h, getAllJavaInfos). It also uses a list of paths, which have been registered by jfw_addJRELocation
. It is checked if the path still contains a valid JRE and if so the respective JavaInfo
object will be appended to the array unless there is already an equal object.
parInfo | [out] on returns it contains a vector of JavaInfo pointers. |
Definition at line 59 of file framework.cxx.
References jfw::FrameworkException::errorCode, FailedVersion, jfw::FwkMutex(), jfw::MergedSettings::getJRELocations(), jfw::getMode(), JFW_E_ERROR, JFW_E_NONE, jfw::JFW_MODE_APPLICATION, jfw_plugin_getAllJavaInfos(), jfw_plugin_getJavaInfoByPath(), jfw::FrameworkException::message, NoJre, NONE, SAL_WARN, and WrongArch.
JVMFWK_DLLPUBLIC javaFrameworkError jfw_findAndSelectJRE | ( | std::unique_ptr< JavaInfo > * | pInfo | ) |
detects a suitable JRE and configures the framework to use it.
Which JREs can be used is determined by the file javavendors.xml, which contains version requirements.
JREs can be provided by different vendors. The function obtains information about JRE installations. If none was found then it also uses a list of paths, which have been registered by jfw_addJRELocation
to find JREs. Found JREs are examined in the same way.
A JRE installation is only selected if it meets the version requirements. Information about the selected JRE are made persistent so that subsequent calls to jfw_getSelectedJRE
returns this information.
While determining a proper JRE this function takes into account if a user requires support for assistive technology tools. If user need that support they have to set up their system accordingly.
If the JAVA_HOME environment variable is set, this function prefers the JRE which the variable refers to over other JREs. If JAVA_HOME is not set or does not refer to a suitable JRE, the PATH environment variable is inspected and the respective JREs are checked for their suitability next.
The first JavaInfo
object that is detected by the algorithm as described above is used.
pInfo | [out] a JavaInfo pointer, representing the selected JRE. The JavaInfo is for informational purposes only. It is not necessary to call jfw_setSelectedJRE afterwards.pInfo can be NULL. |
detects a suitable JRE and configures the framework to use it.
The implementation first inspects JAVA_HOME and PATH environment variables. If no suitable JavaInfo is found there, it inspects all JavaInfos found by the jfw_plugin_get* functions.
Definition at line 360 of file framework.cxx.
References err, jfw::FrameworkException::errorCode, FailedVersion, jfw::FwkMutex(), jfw::MergedSettings::getJRELocations(), jfw::getMode(), JFW_E_DIRECT_MODE, JFW_E_ERROR, JFW_E_NO_JAVA_FOUND, JFW_E_NONE, jfw::JFW_MODE_DIRECT, jfw_plugin_getAllJavaInfos(), jfw_plugin_getJavaInfoByPath(), jfw_plugin_getJavaInfoFromJavaHome(), jfw_plugin_getJavaInfosFromPath(), jfw::FrameworkException::message, NoJre, NONE, SAL_WARN, jfw::NodeJava::setJavaInfo(), jfw::setJavaSelected(), jfw::NodeJava::USER, and jfw::NodeJava::write().
JVMFWK_DLLPUBLIC javaFrameworkError jfw_getEnabled | ( | bool * | pbEnabled | ) |
provides the information if Java can be used.
That is if the user enabled or disabled the use of Java.
Definition at line 651 of file framework.cxx.
References jfw::FrameworkException::errorCode, jfw::FwkMutex(), jfw::MergedSettings::getEnabled(), jfw::getMode(), JFW_E_DIRECT_MODE, JFW_E_NONE, jfw::JFW_MODE_DIRECT, jfw::FrameworkException::message, and SAL_WARN.
JVMFWK_DLLPUBLIC javaFrameworkError jfw_getJavaInfoByPath | ( | OUString const & | pPath, |
std::unique_ptr< JavaInfo > * | ppInfo | ||
) |
determines if a path points to a Java installation.
If the path belongs to a JRE installation then it returns the respective JavaInfo
object. The function uses the getJavaInfoByPath
function of the plug-ins to obtain the JavaInfo
object. Only if the JRE found at the specified location meets the version requirements as specified in the javavendors.xml file a JavaInfo
object is returned.
The functions only checks if a JRE exists but does not modify any settings. To make the found JRE the "selected JRE" one has to call jfw_setSelectedJRE
.
pPath | [in] a file URL to a directory. |
ppInfo | [out] the JavaInfo object which represents a JRE found at the location specified by pPath |
Definition at line 551 of file framework.cxx.
References jfw::FrameworkException::errorCode, FailedVersion, jfw::FwkMutex(), JFW_E_FAILED_VERSION, JFW_E_NONE, JFW_E_NOT_RECOGNIZED, jfw_plugin_getJavaInfoByPath(), jfw::FrameworkException::message, NoJre, NONE, and SAL_WARN.
Referenced by jfw_getSelectedJRE().
JVMFWK_DLLPUBLIC javaFrameworkError jfw_getSelectedJRE | ( | std::unique_ptr< JavaInfo > * | ppInfo | ) |
provides information about the JRE that is to be used.
If no JRE is currently selected then ppInfo
will contain NULL on return. If the value of the element <updated> in the javavendors.xml file was changed since the time when the last Java was selected then this function returns JFW_E_INVALID_SETTINGS
. This could happen during a product patch. Then new version requirements may be introduced, so that the currently selected JRE may not meet these requirements anymore.
In direct mode the function returns information about a JRE that was set by the bootstrap parameter UNO_JAVA_JFW_JREHOME.
ppInfo | [out] on return it contains a pointer to a JavaInfo object that represents the currently selected JRE. When *ppInfo is not NULL then the function sets the pointer. |
Definition at line 497 of file framework.cxx.
References jfw::MergedSettings::createJavaInfo(), jfw::FrameworkException::errorCode, jfw::FwkMutex(), jfw::getElementUpdated(), jfw::MergedSettings::getJavaInfoAttrVendorUpdate(), jfw::BootParams::getJREHome(), jfw::getMode(), JFW_E_CONFIGURATION, JFW_E_INVALID_SETTINGS, JFW_E_NONE, jfw_getJavaInfoByPath(), jfw::JFW_MODE_DIRECT, jfw::FrameworkException::message, and SAL_WARN.
Referenced by jfw_setSelectedJRE(), and jfw_startVM().
JVMFWK_DLLPUBLIC javaFrameworkError jfw_getUserClassPath | ( | OUString * | ppCP | ) |
provides the value of the current user class path.
The function returns an empty string if no user class path is set.
ppCP | [out] contains the user class path on return. |
Definition at line 733 of file framework.cxx.
References jfw::FrameworkException::errorCode, jfw::FwkMutex(), jfw::getMode(), jfw::MergedSettings::getUserClassPath(), JFW_E_DIRECT_MODE, JFW_E_NONE, jfw::JFW_MODE_DIRECT, jfw::FrameworkException::message, and SAL_WARN.
JVMFWK_DLLPUBLIC javaFrameworkError jfw_getVMParameters | ( | std::vector< OUString > * | parParameters | ) |
obtains the currently used start parameters.
parParameters | [out] on returns contains a pointer to the array of the start arguments. |
Definition at line 693 of file framework.cxx.
References jfw::FrameworkException::errorCode, jfw::FwkMutex(), jfw::getMode(), jfw::MergedSettings::getVmParametersArray(), JFW_E_DIRECT_MODE, JFW_E_NONE, jfw::JFW_MODE_DIRECT, jfw::FrameworkException::message, and SAL_WARN.
JVMFWK_DLLPUBLIC bool jfw_isVMRunning | ( | ) |
determines if a Java Virtual Machine is already running.
As long as the office and the JREs only support one Virtual Machine per process the Java settings, particularly the selected Java, are not effective immediately after changing when a VM has already been running. That is, if a JRE A was used to start a VM and then a JRE B is selected, then JRE B will only be used after a restart of the office.
By determining if a VM is running, the user can be presented a message, that the changed setting may not be effective immediately.
Definition at line 545 of file framework.cxx.
References jfw::FwkMutex().
JVMFWK_DLLPUBLIC void jfw_lock | ( | ) |
locks this API so that it cannot be used by other threads.
If a different thread called this function before then the current call is blocked until the other thread has called jfw_unlock()
. The function should be called if one needs an exact snapshot of the current settings. Then the settings are retrieved one by one without risk that the settings may be changed by a different thread. Similarity if one needs to make settings which should become effective at the same time then jfw_lock
should be called. That is, jfw_startVM
which uses the settings cannot be called before all settings have be made.
The only functions which is not effected by jfw_lock
is jfw_areEqualJavaInfo
.
Definition at line 795 of file framework.cxx.
References jfw::FwkMutex().
JVMFWK_DLLPUBLIC javaFrameworkError jfw_setEnabled | ( | bool | bEnabled | ) |
determines if Java can be used.
If bEnabled
is false
then a call to jfw_startVM will result in an error with the errorcode JFW_E_JAVA_DISABLED
bEnabled | [in] use of Java enabled/disabled. |
Definition at line 618 of file framework.cxx.
References jfw::FrameworkException::errorCode, jfw::FwkMutex(), jfw::MergedSettings::getEnabled(), jfw::getMode(), JFW_E_DIRECT_MODE, JFW_E_NONE, jfw::JFW_MODE_DIRECT, jfw::FrameworkException::message, SAL_WARN, jfw::NodeJava::setEnabled(), jfw::NodeJava::USER, and jfw::NodeJava::write().
JVMFWK_DLLPUBLIC javaFrameworkError jfw_setSelectedJRE | ( | JavaInfo const * | pInfo | ) |
determines the JRE that is to be used.
When calling jfw_startVM
then a VM is started from the JRE that is determined by this function.
It is not verified if the JRE represented by the JavaInfo
argument meets the requirements as specified by the javavendors.xml file. However, usually one obtains the JavaInfo
object from the functions jfw_findAllJREs
or jfw_getJavaInfoByPath
, which do verify the JREs and pass out only JavaInfo
objects which comply with the version requirements.
If pInfo
is NULL then the meaning is that no JRE will be selected. jfw_startVM
will then return JFW_E_NO_SELECT
.
pInfo | [in] pointer to JavaInfo structure, containing data about a JRE. The caller must still free pInfo . |
Definition at line 588 of file framework.cxx.
References jfw::FrameworkException::errorCode, jfw::FwkMutex(), jfw::getMode(), jfw_areEqualJavaInfo(), JFW_E_DIRECT_MODE, JFW_E_INVALID_SETTINGS, JFW_E_NONE, jfw_getSelectedJRE(), jfw::JFW_MODE_DIRECT, jfw::FrameworkException::message, SAL_WARN, jfw::NodeJava::setJavaInfo(), jfw::setJavaSelected(), jfw::NodeJava::USER, and jfw::NodeJava::write().
JVMFWK_DLLPUBLIC javaFrameworkError jfw_setUserClassPath | ( | OUString const & | pCP | ) |
sets the user class path.
When the VM is started then it is passed the class path. The class path also contains the user class path set by this function. The paths contained in pCP
must be separated with a system dependent path separator.
pCP | [in] the user class path. |
Definition at line 713 of file framework.cxx.
References jfw::FrameworkException::errorCode, jfw::FwkMutex(), jfw::getMode(), JFW_E_DIRECT_MODE, JFW_E_NONE, jfw::JFW_MODE_DIRECT, jfw::FrameworkException::message, SAL_WARN, jfw::NodeJava::setUserClassPath(), jfw::NodeJava::USER, and jfw::NodeJava::write().
JVMFWK_DLLPUBLIC javaFrameworkError jfw_setVMParameters | ( | std::vector< OUString > const & | arArgs | ) |
determines parameters which are passed to VM during its creation.
The strings must be exactly as they are passed on the command line. For example, one could pass
-Xdebug
-Xrunjdw:transport=dt_socket,server=y,address=8000
in order to enable debugging support.
arParameters | [in] contains the arguments. |
Definition at line 672 of file framework.cxx.
References jfw::FrameworkException::errorCode, jfw::FwkMutex(), jfw::getMode(), JFW_E_DIRECT_MODE, JFW_E_NONE, jfw::JFW_MODE_DIRECT, jfw::FrameworkException::message, SAL_WARN, jfw::NodeJava::setVmParameters(), jfw::NodeJava::USER, and jfw::NodeJava::write().
JVMFWK_DLLPUBLIC javaFrameworkError jfw_startVM | ( | JavaInfo const * | pInfo, |
std::vector< OUString > const & | arOptions, | ||
JavaVM ** | ppVM, | ||
JNIEnv ** | ppEnv | ||
) |
starts a Java Virtual Machine (JVM).
The function uses the current settings to start a JVM. The actual start-up code, however, is provided by the plug-in libraries. The setting of the "selected Java" contains the information as to what vendor the respective JRE comes from. In the javavendors.xml there is a mapping of vendor names to the respective plug-in libraries.
The function ultimately calls startJavaVirtualMachine
from the plug-in library.
The arOptions
argument contains start arguments which are passed in JavaVMOption structures to the VM during its creation. These could be things, such as language settings, proxy settings or any other properties which shall be obtainable by java.lang.System.getProperties
. One can also pass options which have a certain meaning to the runtime behaviour such as -ea or -X... However, one must be sure that these options can be interpreted by the VM.
The class path cannot be set this way. The class path is internally composed by the paths to archives in a certain directory, which is preconfigured in the internal data store and the respective user setting (see jfw_setUserClassPath
.
If a JRE was selected at runtime which was different from the previous setting and that JRE needs a prepared environment, for example an adapted LD_LIBRARY_PATH
environment variable, then the VM will not be created and JFW_E_NEED_RESTART error is returned. If a VM is already running then a JFW_E_RUNNING_JVM is returned.
pInfo | [in] optional pointer to a specific JRE; must be caller-freed if not NULL |
arOptions | [in] the vector containing additional start arguments. |
ppVM | [out] the JavaVM pointer. |
ppEnv | [out] the JNIenv pointer. |
JAVA_HOME
does not meet the version requirements. Definition at line 170 of file framework.cxx.
References jfw::MergedSettings::createJavaInfo(), jfw::FrameworkException::errorCode, jfw::FwkMutex(), jfw::BootParams::getClasspath(), jfw::getElementUpdated(), jfw::MergedSettings::getEnabled(), jfw::MergedSettings::getJavaInfoAttrVendorUpdate(), jfw::getMode(), jfw::MergedSettings::getUserClassPath(), jfw::BootParams::getVMParameters(), jfw::MergedSettings::getVmParametersUtf8(), index, jfw_convertUserPathList(), JFW_E_ERROR, JFW_E_INVALID_SETTINGS, JFW_E_JAVA_DISABLED, JFW_E_NEED_RESTART, JFW_E_NO_SELECT, JFW_E_NONE, JFW_E_RUNNING_JVM, JFW_E_VM_CREATION_FAILED, jfw_getSelectedJRE(), jfw::JFW_MODE_APPLICATION, jfw::JFW_MODE_DIRECT, jfw_plugin_startJavaVirtualMachine(), JFW_REQUIRE_NEEDRESTART, jfw::makeClassPathOption(), jfw::FrameworkException::message, mode, NONE, OUStringToOString(), pData, SAL_INFO, SAL_PATHSEPARATOR, SAL_WARN, JavaInfo::sLocation, VmCreationFailed, and jfw::wasJavaSelectedInSameProcess().
JVMFWK_DLLPUBLIC void jfw_unlock | ( | ) |
unlocks this API.
This function is called after jfw_lock
. It allows other threads to use this API concurrently.
Definition at line 800 of file framework.cxx.
References jfw::FwkMutex().