diff --git a/include/jvmfwk/framework.h b/include/jvmfwk/framework.h
index 7abf3e1c9195..8421134b8ae7 100644
--- a/include/jvmfwk/framework.h
+++ b/include/jvmfwk/framework.h
@@ -72,7 +72,7 @@ extern "C" {
necessary to specify the bootstrap parameter UNO_JAVA_JFW_SHARED_DATA
.
Setting the class path used by a Java VM should not be necesarry. The locations +
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 @@ -320,16 +320,11 @@ JVMFWK_DLLPUBLIC javaFrameworkError SAL_CALL jfw_isVMRunning(sal_Bool *bRunning) /** 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, as well as information about available - plug-in libraries. Only these libraries are responsible for locating JRE - installations.
+ which contains version requirements.
- JREs can be provided by different vendors. In order to find the JREs of
- a certain vendor a plug-in library must be provided. There must be only one
- library for one vendor. The names of locations of those libraries have to
- be put into the javavendors.xml file.
- The function uses the plug-in libraries to obtain information about JRE
- installation and checks if they there is one among them that supports
+ JREs can be provided by different vendors.
+ The function obtains information about JRE installations and checks if
+ there is one among them that supports
a set of features (currently only accessibilty is possible). If none was
found then it also uses a list of paths, which have been registered
by jfw_addJRELocation
@@ -342,27 +337,36 @@ JVMFWK_DLLPUBLIC javaFrameworkError SAL_CALL jfw_isVMRunning(sal_Bool *bRunning)
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. When support - for assistive technology is required, then the lists of + 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.
+
+ When support for assistive technology is required, then the
JavaInfo
objects,
- which are provided by the getJavaInfo
functions of the plug-ins, are
- examined for a suitable JRE. That is, the JavaInfo
objects
- from the list
- obtained from the first plug-in, are examined. If no JavaInfo
- object has the flag
+ which are provided by the getJavaInfo
functions, are
+ examined for a suitable JRE.
+ That is, the JavaInfo
object that refers to the JRE referred to
+ by JAVA_HOME is examined. If it does not have the flag
JFW_FEATURE_ACCESSBRIDGE
in the member nFeatures
- then the
- next plug-in is used to obtain a list of JavaInfo
objects.
+ then the JavaInfo
object is found, all JavaInfo
+ objects - representing Java installations on the system -, are examined.
+ As long as no JavaInfo
object has the flag
+ JFW_FEATURE_ACCESSBRIDGE
in the member nFeatures
, more
+ JavaInfo
objects are examined.
This goes on until a JavaInfo
object was found which
- represents a suitable JRE. Or neither plug-in provided such a
- JavaInfo
object. In that case the first
- JavaInfo
object from the first plug-in is used to determine
- the JRE which is to be used.
JavaInfo
object was found.
+ In that case the first JavaInfo
object that was detected
+ by the algorithm described above is used to determine the JRE which is to be used.
If there is no need for the support of assistive technology tools then
- the first JavaInfo
object from the list obtained by the
- first plug-in is used. If this plug-in does not find any JREs then the
- next plug-in is used, and so on.
JavaInfo
object that is detected by the algorithm
+ as described above is used.
@param ppInfo
[out] a JavaInfo
pointer, representing the selected JRE.
diff --git a/jvmfwk/inc/vendorplugin.hxx b/jvmfwk/inc/vendorplugin.hxx
index 3fd4d3591257..35131df27cef 100644
--- a/jvmfwk/inc/vendorplugin.hxx
+++ b/jvmfwk/inc/vendorplugin.hxx
@@ -24,6 +24,9 @@
#include If the JAVA_HOME environment variable is set and points to a JRE whoose vendor + matches the requirements given by vecVendorInfos (i.e. it has a vendor that is + given in vecVendorInfos and the version requirements for the vendor are met), + then this function shall return a JavaInfo object for this JRE.
+ + @param vecVendorInfos + [in] vector specifying the vendor and version requirements that the JRE must fulfill. + The vector contains pairs of vendors and the respective version requirements + for those vendors. The JRE must support the requirements of one given pair in the + vector (i.e. it must be of one of the vendors and meet the version requirements + - minVersion, maxVersion, excludeVersions - for that specific vendor). + @param ppInfo + [out] if the JAVA_HOME environment variable is set and points to a suitable + JRE, then thenppInfo
contains
+ on return a pointer to its JavaInfo
object.
+
+ @return
+ JFW_PLUGIN_E_NONE the function ran successfully.
+ JFW_PLUGIN_E_INVALID_ARG an argument was not valid, for example
+ ppInfo
is an invalid pointer.
+ JFW_PLUGIN_E_NO_JRE no suitable JRE could be detected at the given location. However, that
+ does not mean necessarily that there is no JRE. There could be a JRE but it has
+ a vendor which is not supported by this API implementation or it does not
+ meet the version requirements.
+ */
+javaPluginError jfw_plugin_getJavaInfoFromJavaHome(
+ std::vectorThe function gathers information about available JREs which are on the PATH
+ (PATH environment variable) and meet the vendor and version requirements given by
+ vecVendorInfos
(i.e. they have a vendor that is given in
+ vecVendorInfos
and the version requirements for the vendor are met).
+
+ The JavaInfo structures returned in vecJavaInfosFromPath
should be ordered
+ according to their occurrence in the PATH. The one that is the first one on the PATH
+ is also the first element in the vector.
+ The function allocates memory for all the JavaInfo objects returned
+ in vecJavaInfosFromPath
. The caller must free each JavaInfo object by calling
+ jfw_freeJavaInfo
(#include "jvmfwk/framework.h").
+
vecJavaInfosFromPath
+ contains on return a vector of pointers to JavaInfo
objects.
+ On return of this function, vecJavaInfosFromPath
references
+ a newly created vector rather than the same vector as before with
+ the JavaInfo
objects inserted into the existing vector.
+
+ @return
+ JFW_PLUGIN_E_NONE the function ran successfully and at least one JRE
+ that meets the requirements was found.
+ JFW_PLUGIN_E_NO_JRE no JavaInfo that meets the version criteria was found
+ when inspecting the PATH
+ */
+
+javaPluginError jfw_plugin_getJavaInfosFromPath(
+ std::vectorThe caller should provide all essential JavaVMOptions, such as the
diff --git a/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx b/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx
index d0dac260a354..1771bcc018a5 100644
--- a/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx
+++ b/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx
@@ -404,6 +404,105 @@ javaPluginError jfw_plugin_getJavaInfoByPath(
return errorcode;
}
+javaPluginError jfw_plugin_getJavaInfoFromJavaHome(
+ std::vector