1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
22 #ifndef INCLUDED_JVMFWK_FRAMEWORK_HXX
23 #define INCLUDED_JVMFWK_FRAMEWORK_HXX
25 #include <jvmfwk/jvmfwkdllapi.hxx>
26 #include <rtl/byteseq.hxx>
27 #include <rtl/ustring.h>
28 #include <rtl/ustring.hxx>
29 #include <osl/mutex.h>
33 <p>This library can operate in two modes, application mode and direct mode.</p>
36 <h2>Application Mode</h2>
37 In application mode the Java related settings are stored in files.
38 There are currently three files which need to be accessed. They are determined
39 by bootstrap parameters:</p>
41 <dt>UNO_JAVA_JFW_VENDOR_SETTINGS</dt>
42 <dd>contains vendor and version information about JREs as well as the
43 location of plugin-libraries which are responsible for providing information
44 about these JREs as well as starting the VMs.</dd>
45 <dt>UNO_JAVA_JFW_USER_DATA</dt>
46 <dd>The file contains settings for a particular user. One can use the macro
47 $SYSUSERCONFIG in the URL which expands to a directory where the user's data are
48 kept. On UNIX this would be the home directory and on Windows some sub-directory
49 of the "Documents and Settings" folder.The content of this file is an
50 implementation detail and may change in the future.</dd>
51 <dt>UNO_JAVA_JFW_SHARED_DATA</dt>
52 <dd>The file contains settings valid for all users. If a user changes a setting
53 then it takes precedence over the setting from UNO_JAVA_JFW_SHARED_DATA.
54 The content of this file is an implementation detail and may change in the future.</dd>
57 <p>The values for these parameters must be file URLs and include the file name, for
59 file:///d:/MyApp/javavendors.xml<br>
60 All files are XML files and must have the extension .xml.</p>
62 Modifying the shared settings is currently not supported by the framework. To provide
63 Java settings for all users one can run OOo and change the settings in the
64 options dialog. These settings are made persistent in the UNO_JAVA_JFW_USER_DATA.
65 The file can then be copied into the base installation.
66 Other users will use automatically these data but can override the settings in
67 the options dialog. This mechanism may change in the future.
69 <p>If shared Java settings are not supported by an application then it is not
70 necessary to specify the bootstrap parameter <code>UNO_JAVA_JFW_SHARED_DATA</code>.
73 <p>Setting the class path used by a Java VM should not be necessary. The locations
74 of Jar files should be known by a class loader. If a jar file depends on another
75 jar file then it can be referenced in the manifest file of the first jar. However,
76 a user may add jars to the class path by using this API. If it becomes necessary
77 to add files to the class path which is to be used by all users then one can use
78 the bootstrap parameter UNO_JAVA_JFW_CLASSPATH_URLS. The value contains of file URLs
79 which must be separated by spaces.</p>
84 <p>The direct mode is intended for a scenario where no configuration files
85 are available and a Java VM shall be run. That is,
86 the files containing the user and shared settings are not specified by the
87 bootstrap parameters UNO_JAVA_JFW_SHARED_DATA and UNO_JAVA_JFW_USER_DATA.
88 For example, tools, such as regcomp, may use this framework in a build
89 environment. Then one would want to use settings which have been specified
90 by the build environment. The framework would automatically use the
91 current settings when they change in the environment.
94 <p> Here are examples how regcomp could be invoked using bootstrap parameters:
97 regcomp -env:UNO_JAVA_JFW_JREHOME=file:///d:/j2re1.4.2
98 -env:"UNO_JAVA_JFW_CLASSPATH=d:\\solver\\bin\\classes.jar;d:\\solver\\bin\\jurt.jar"
101 <p>If UNO_JAVA_JFW_VENDOR_SETTINGS is not set then a plugin library must be specified. For example:</p>
103 regcomp -env:UNO_JAVA_JFW_JREHOME=file:///d:/j2re1.4.2
104 -env:"UNO_JAVA_JFW_CLASSPATH=d:\\solver\\bin\\classes.jar;d:\\solver\\bin\\jurt.jar"
107 <p>Additional parameters for the Java VM can be provided. For every parameter
108 a separate bootstrap parameter must be specified. The names are
109 <code>UNO_JAVA_JFW_PARAMETER_X</code>, where X is 1,2, .. n. For example:</p>
111 regcomp -env:UNO_JAVA_JFW_PARAMETER_1=-Xdebug
112 -env:UNO_JAVA_JFW_PARAMETER_2=-Xrunjdwp:transport=dt_socket,server=y,address=8100
113 -env:UNO_JAVA_JFW_JREHOME=file:///d:/j2re1.4.2
114 -env:"UNO_JAVA_JFW_CLASSPATH=d:\\solver\\bin\\classes.jar;d:\\solver\\bin\\jurt.jar"
117 Here is a complete list of the bootstrap parameter for the direct mode:
120 <dt>UNO_JAVA_JFW_JREHOME</dt>
121 <dd>Specifies a file URL to a JRE installation.It must ALWAYS be specified
123 <dt>UNO_JAVA_JFW_ENV_JREHOME</dt>
124 <dd>Setting this parameter, for example to "1" or "true",
125 causes the framework to use the environment variable JAVA_HOME. It is expected
126 that JAVA_HOME contains a system path rather than a file URL. This parameter
127 and UNO_JAVA_JFW_JREHOME are mutually exclusive</dd>
128 <dt>UNO_JAVA_JFW_CLASSPATH</dt>
129 <dd>Contains the class path which is to be used by the VM. Special character,
130 such as '\','{','}','$' must be preceded with '\'. See documentation about the
131 bootstrap parameter.</dd>
132 <dt>UNO_JAVA_JFW_ENV_CLASSPATH</dt>
133 <dd>Setting this parameter,for example to "1" or "true",
134 causes the framework to use the
135 environment variable CLASSPATH. If this variable and UNO_JAVA_JFW_CLASSPATH are
136 set then the class path is composed from UNO_JAVA_JFW_CLASSPATH and the environment
137 variable CLASSPATH.</dd>
138 <dt>UNO_JAVA_JFW_PARAMETER_X</dt>
139 <dd>Specifies a parameter for the Java VM. The X is replaced by
140 non-negative natural numbers starting with 1.</dd>
143 <p>A note about bootstrap parameters. The implementation of the bootstrap
144 parameter mechanism interprets the characters '\', '$', '{', '}' as
145 escape characters. Thats why the Windows path contain double back-slashes.
146 One should also take into account that a console may have also special
147 escape characters.</p>
149 <h2>What mode is used</h2>
151 The default mode is application mode. If at least one bootstrap parameter
152 for the direct mode is provided then direct mode is used. </p>
155 All settings made by this API are done for the current user if not
156 mentioned differently.</p>
158 <h2>Other bootstrap variables</h2>
160 <dt>JFW_PLUGIN_DO_NOT_CHECK_ACCESSIBILITY</dt>
161 <dd>This is a unofficial variable which was introduced to workaround external issues.
162 It may be removed in the future. By setting it to 1, the framework will not try to
163 find out if the system is configured to use accessibility tools or if a JRE has an
164 accessible bridge installed</dd>
165 <dt>JFW_PLUGIN_FORCE_ACCESSIBILITY</dt>
166 <dd>This is a unofficial variable which was introduced to workaround external issues.
167 It may be removed in the future. By setting it to 1, the framework will override a
168 platform's desire not to probe each java backend to determine if it has an accessibility
169 bridge installed. If the JFW_PLUGIN_DO_NOT_CHECK_ACCESSIBILITY is set this variable has
170 no effect, and is Unix specific.</dd>
174 /** indicates that a JRE has an accessibility bridge installed.
176 The flag is used with JavaInfo::nFeatures.</p>
178 #define JFW_FEATURE_ACCESSBRIDGE 0x1l
179 /** indicates that there must be an environment set up before the Java process
181 <p>Therefore, when a Java is selected in OO then the office must be
182 restarted, so that the changes can take effect.</p>
184 #define JFW_REQUIRE_NEEDRESTART 0x1l
186 /** error codes which are returned by functions of this API.
188 enum javaFrameworkError
194 JFW_E_INVALID_SETTINGS
,
198 JFW_E_NOT_RECOGNIZED
,
199 JFW_E_FAILED_VERSION
,
201 JFW_E_VM_CREATION_FAILED
,
206 /** an instance of this struct represents an installation of a Java
207 Runtime Environment (JRE).
210 Instances of this struct are created by the plug-in libraries which are used by
211 this framework (jvmfwk/vendorplugin.h).</p>
215 /** contains the vendor.
217 <p>string must be the same as the one obtained from the
218 Java system property <code>java.vendor</code>.
222 /** contains the file URL to the installation directory.
225 /** contains the version of this Java distribution.
227 <p>The version string must adhere to the rules
228 about how a version string has to be formed. These rules may
229 be vendor-dependent. Essentially the strings must syntactically
230 equal the Java system property <code>java.version</code>.
234 /** indicates supported special features.
236 <p>For example, <code>JFW_FEATURE_ACCESSBRIDGE</code> indicates that
237 assistive technology tools are supported.</p>
239 sal_uInt64 nFeatures
;
240 /** indicates requirments for running the java runtime.
242 <p>For example, it may be necessary to prepare the environment before
243 the runtime is created. That could mean, setting the
244 <code>LD_LIBRARY_PATH</code>
245 when <code>nRequirements</code> contains the flag
246 <code>JFW_REQUIRE_NEEDRESTART</code></p>
248 sal_uInt64 nRequirements
;
249 /** contains data needed for the creation of the java runtime.
251 <p>There is no rule about the format and content of the sequence's
252 values. The plug-in libraries can put all data, necessary for
253 starting the java runtime into this sequence. </p>
255 rtl::ByteSequence arVendorData
;
260 struct JavaInfoGuard
{
261 JavaInfoGuard(JavaInfoGuard
&) = delete;
262 void operator =(JavaInfoGuard
) = delete;
264 JavaInfoGuard(): info(nullptr) {}
266 ~JavaInfoGuard() { delete info
; }
278 /** compares two <code>JavaInfo</code> objects for equality.
280 <p>Two <code>JavaInfo</code> objects are said to be equal if the contained
281 members of the first <code>JavaInfo</code> are equal to their counterparts
282 in the second <code>JavaInfo</code> object. The equality of the
283 <code>OUString</code> members is determined
284 by <code>operator ==</code>.
285 Similarly the equality of the <code>rtl::ByteSequence</code> is
286 also determined by a comparison
287 function (see <code>rtl::ByteSequence::operator ==</code>). </p>
289 Both argument pointers must be valid.</p>
293 the second argument which is compared with the first.
295 true - both object represent the same JRE.</br>
296 false - the objects represend different JREs
298 JVMFWK_DLLPUBLIC
bool jfw_areEqualJavaInfo(
299 JavaInfo
const * pInfoA
,JavaInfo
const * pInfoB
);
301 /** determines if a Java Virtual Machine is already running.
303 <p>As long as the office and the JREs only support one
304 Virtual Machine per process the Java settings, particularly the
305 selected Java, are not effective immediately after changing when
306 a VM has already been running. That is, if a JRE A was used to start
307 a VM and then a JRE B is selected, then JRE B will only be used
308 after a restart of the office.</p>
310 By determining if a VM is running, the user can be presented a message,
311 that the changed setting may not be effective immediately.</p>
314 [out] sal_True - a VM is running. <br/>
315 sal_False - no VM is running.
318 JFW_E_NONE function ran successfully.<br/>
319 JFW_E_INVALID_ARG the parameter <code>bRunning</code> was NULL.
321 JVMFWK_DLLPUBLIC javaFrameworkError
jfw_isVMRunning(sal_Bool
*bRunning
);
323 /** detects a suitable JRE and configures the framework to use it.
325 <p>Which JREs can be used is determined by the file javavendors.xml,
326 which contains version requirements.</p>
328 JREs can be provided by different vendors.
329 The function obtains information about JRE installations and checks if
330 there is one among them that supports
331 a set of features (currently only accessibilty is possible). If none was
332 found then it also uses a list of paths, which have been registered
333 by <code>jfw_addJRELocation</code>
334 to find JREs. Found JREs are examined in the same way.</p>
336 A JRE installation is only selected if it meets the version requirements.
337 Information about the selected JRE are made persistent so that
338 subsequent calls to <code>jfw_getSelectedJRE</code> returns this
341 While determining a proper JRE this function takes into account if a
342 user requires support for assistive technology tools. If user
343 need that support they have to set up their system accordingly.</p>
345 If the JAVA_HOME environment variable is set, this function prefers
346 the JRE which the variable refers to over other JREs.
347 If JAVA_HOME is not set or does not refer to a suitable JRE,
348 the PATH environment variable is inspected and the respective JREs
349 are checked for their suitability next.</p>
351 When support for assistive technology is required, then the
352 <code>JavaInfo</code> objects,
353 which are provided by the <code>getJavaInfo</code> functions, are
354 examined for a suitable JRE.
355 That is, the <code>JavaInfo</code> object that refers to the JRE referred to
356 by JAVA_HOME is examined. If it does not have the flag
357 <code>JFW_FEATURE_ACCESSBRIDGE</code> in the member <code>nFeatures</code>
358 then the <JavaInfo></code> objects that are related to the PATH variable
360 If no suitable <code>JavaInfo</code> object is found, all <code>JavaInfo</code>
361 objects - representing Java installations on the system -, are examined.
362 As long as no <code>JavaInfo</code> object has the flag
363 <code>JFW_FEATURE_ACCESSBRIDGE</code> in the member <code>nFeatures</code>, more
364 <code>JavaInfo</code> objects are examined.
365 This goes on until a <code>JavaInfo</code> object was found which
366 represents a suitable JRE. Or no such <code>JavaInfo</code> object was found.
367 In that case the first <code>JavaInfo</code> object that was detected
368 by the algorithm described above is used to determine the JRE which is to be used.</p>
370 If there is no need for the support of assistive technology tools then
371 the first <code>JavaInfo</code> object that is detected by the algorithm
372 as described above is used.</p>
375 [out] a <code>JavaInfo</code> pointer, representing the selected JRE.
376 The caller has to delete it. The
377 <code>JavaInfo</code> is for informational purposes only. It is not
378 necessary to call <code>jfw_setSelectedJRE</code> afterwards.<br/>
379 <code>ppInfo</code>can be NULL. If <code>*ppInfo</code> is not null, then it is
380 overwritten, without attempting to free <code>*ppInfo</code>.
383 JFW_E_NONE function ran successfully.<br/>
384 JFW_E_ERROR an error occurred. <br/>
385 JFW_E_NO_JAVA_FOUND no JRE was found that meets the requirements.</br>
386 JFW_E_DIRECT_MODE the function cannot be used in this mode. </br>
387 JFW_E_CONFIGURATION mode was not properly set or their prerequisites
390 JVMFWK_DLLPUBLIC javaFrameworkError
jfw_findAndSelectJRE(JavaInfo
**pInfo
);
392 /** provides information about all available JRE installations.
394 <p>The function determines dynamically what JREs are available. It uses
395 the plug-in libraries to provide lists of available <code>JavaInfo</code>
396 objects where each object represents a JRE (see vendorplugin.h,
397 getAllJavaInfos). It also uses a list of paths, which have been registered
398 by <code>jfw_addJRELocation</code>.
399 It is checked if the path still contains a valid JRE and if so the respective
400 <code>JavaInfo</code> object will be appended to the array unless there is
401 already an equal object.</p>
404 [out] on returns it contains a pointer to an array of <code>JavaInfo</code>
406 The caller must free the array with <code>rtl_freeMemory</code> and each
407 element of the array must be deleted.
409 [out] on return contains the size of array returned in <code>parInfo</code>.
412 JFW_E_NONE function ran successfully.<br/>
413 JFW_E_INVALID_ARG at least on of the parameters was NULL<br/>
414 JFW_E_ERROR an error occurred. <br/>
415 JFW_E_CONFIGURATION mode was not properly set or their prerequisites
418 JVMFWK_DLLPUBLIC javaFrameworkError
jfw_findAllJREs(
419 JavaInfo
***parInfo
, sal_Int32
*pSize
);
421 /** determines if a path points to a Java installation.
423 <p>If the path belongs to a JRE installation then it returns the
424 respective <code>JavaInfo</code> object. The function uses the
425 <code>getJavaInfoByPath</code> function of the plug-ins to obtain the
426 <code>JavaInfo</code> object. Only if the JRE found at the specified location
427 meets the version requirements as specified in the javavendors.xml file a
428 <code>JavaInfo</code> object is returned.<br/>
430 The functions only checks if a JRE exists but does not modify any settings.
431 To make the found JRE the "selected JRE" one has
432 to call <code>jfw_setSelectedJRE</code>.</p>
435 [in] a file URL to a directory.
437 [out] the <code>JavaInfo</code> object which represents a JRE found at the
438 location specified by <code>pPath</code>
441 JFW_E_NONE function ran successfully.<br/>
442 JFW_E_INVALID_ARG at least on of the parameters was NULL<br/>
443 JFW_E_ERROR an error occurred. <br/>
444 JFW_E_CONFIGURATION mode was not properly set or their prerequisites
446 JFW_E_NOT_RECOGNIZED neither plug-in library could detect a JRE. <br/>
447 JFW_E_FAILED_VERSION a JRE was detected but if failed the version
448 requirements as determined by the javavendors.xml
450 JVMFWK_DLLPUBLIC javaFrameworkError
jfw_getJavaInfoByPath(
451 rtl_uString
*pPath
, JavaInfo
**ppInfo
);
454 /** starts a Java Virtual Machine (JVM).
456 <p>The function uses the current settings to start a JVM. The actual
457 start-up code, however, is provided by the plug-in libraries. The setting
458 of the "selected Java" contains the information as to what vendor
459 the respective JRE comes from. In the javavendors.xml there is a mapping of
460 vendor names to the respective plug-in libraries.</p>
462 The function ultimately calls <code>startJavaVirtualMachine</code> from
463 the plug-in library.</p>
465 The <code>arOptions</code>
466 argument contains start arguments which are passed in JavaVMOption structures
467 to the VM during its creation. These
468 could be things, such as language settings, proxy settings or any other
469 properties which shall be obtainable by
470 <code>java.lang.System.getProperties</code>. One can also pass options which
471 have a certain meaning to the runtime behaviour such as -ea or -X... However,
472 one must be sure that these options can be interpreted by the VM.<br/>
473 The class path cannot be set this way. The class path is internally composed by
474 the paths to archives in a certain directory, which is preconfigured in
475 the internal data store and the respective user setting (see
476 <code>jfw_setUserClassPath</code>.</p>
478 If a JRE was selected at runtime which was different from the previous
479 setting and that JRE needs a prepared environment, for example an adapted
480 <code>LD_LIBRARY_PATH</code> environment variable, then the VM will not be
481 created and JFW_E_NEED_RESTART error is returned. If a VM is already running
482 then a JFW_E_RUNNING_JVM is returned.</p>
485 [in] optional pointer to a specific JRE; must be caller-freed if not NULL
487 [in] the array containing additional start arguments or NULL.
489 [in] the size of the array <code>arOptions</code>.
491 [out] the <code>JavaVM</code> pointer.
493 [out] the <code>JNIenv</code> pointer.
496 JFW_E_NONE function ran successfully.<br/>
497 JFW_E_INVALID_ARG <code>ppVM</code>, <code>ppEnv</code> are NULL or
498 <code>arOptions</code> was NULL but <code>nSize</code> was greater 0.<br/>
499 JFW_E_ERROR an error occurred. <br/>
500 JFW_E_CONFIGURATION mode was not properly set or their prerequisites
502 JFW_E_JAVA_DISABLED the use of Java is currently disabled. <br/>
503 JFW_E_NO_SELECT there is no JRE selected yet. <br/>
504 JFW_E_RUNNIN_JVM there is already a VM running.<br/>
505 JFW_E_INVALID_SETTINGS the javavendors.xml has been changed and no
506 JRE has been selected afterwards. <br/>
507 JFW_E_NEED_RESTART in the current process a different JRE has been selected
508 which needs a prepared environment, which has to be done before the office
509 process. Therefore the new JRE may not be used until the office was restarted.<br/>
510 JFW_E_NEED_RESTART is also returned when Java was disabled at the beginning and
511 then the user enabled it. If then the selected JRE has the requirement
512 JFW_REQUIRE_NEEDRESTART then this error is returned. </br>
513 JFW_E_VM_CREATION_FAILED the creation of the JVM failed. The creation is performed
514 by a plug-in library and not by this API.
515 JFW_E_FAILED_VERSION the "Default Mode" is active. The JRE determined by
516 <code>JAVA_HOME</code>does not meet the version requirements.
518 JVMFWK_DLLPUBLIC javaFrameworkError
jfw_startVM(
519 JavaInfo
const * pInfo
, JavaVMOption
* arOptions
, sal_Int32 nSize
,
520 JavaVM
** ppVM
, JNIEnv
** ppEnv
);
522 /** determines the JRE that is to be used.
524 <p>When calling <code>jfw_startVM</code> then a VM is startet from
525 the JRE that is determined by this function.<br/>
526 It is not verified if the JRE represented by the <code>JavaInfo</code>
527 argument meets the requirements as specified by the javavendors.xml file.
528 However, usually one obtains the <code>JavaInfo</code> object from the
529 functions <code>jfw_findAllJREs</code> or <code>jfw_getJavaInfoByPath</code>,
530 which do verify the JREs and pass out only <code>JavaInfo</code> objects
531 which comply with the version requirements.</p>
533 If <code>pInfo</code> is NULL then the meaning is that no JRE will be
534 selected. <code>jfw_startVM</code> will then return
535 <code>JFW_E_NO_SELECT</code>.</p>
538 [in] pointer to <code>JavaInfo</code> structure, containing data about a
539 JRE. The caller must still free <code>pInfo</code>.
542 JFW_E_NONE function ran successfully.<br/>
543 JFW_E_ERROR An error occurred.<br/>
544 JFW_E_CONFIGURATION mode was not properly set or their prerequisites
546 JFW_E_DIRECT_MODE the function cannot be used in this mode.
548 JVMFWK_DLLPUBLIC javaFrameworkError
jfw_setSelectedJRE(JavaInfo
const *pInfo
);
551 /** provides information about the JRE that is to be used.
553 <p>If no JRE is currently selected then <code>ppInfo</code> will contain
555 If the value of the element <updated> in the javavendors.xml file was
556 changed since the time when the last Java was selected then this
557 function returns <code>JFW_E_INVALID_SETTINGS</code>. This could happen during
558 a product patch. Then new version requirements may be introduced, so that
559 the currently selected JRE may not meet these requirements anymore.
561 <p>In direct mode the function returns information about a JRE that was
562 set by the bootstrap parameter UNO_JAVA_JFW_JREHOME.
565 [out] on return it contains a pointer to a <code>JavaInfo</code> object
566 that represents the currently selected JRE. When <code>*ppInfo</code> is not
567 NULL then the function overwrites the pointer. It is not attempted to free
571 JFW_E_NONE function ran successfully.<br/>
572 JFW_E_INVALIDARG <code>ppInfo</code> is a NULL.<br/>
573 JFW_E_CONFIGURATION mode was not properly set or their prerequisites
575 JFW_E_INVALID_SETTINGS the javavendors.xml has been changed and no
576 JRE has been selected afterwards. <br/>
578 JVMFWK_DLLPUBLIC javaFrameworkError
jfw_getSelectedJRE(JavaInfo
**ppInfo
);
581 /** determines if Java can be used.
583 <p>If <code>bEnabled</code> is <code>false</code> then a call
584 to jfw_startVM will result in an error with the errorcode
585 <code>JFW_E_JAVA_DISABLED</code></p>
588 [in] use of Java enabled/disabled.
591 JFW_E_NONE function ran successfully.<br/>
592 JFW_E_ERROR An error occurred.<br/>
593 JFW_E_CONFIGURATION mode was not properly set or their prerequisites
595 JFW_E_DIRECT_MODE the function cannot be used in this mode.
597 JVMFWK_DLLPUBLIC javaFrameworkError
jfw_setEnabled(bool bEnabled
);
599 /** provides the information if Java can be used.
601 <p>That is if the user enabled or disabled the use of Java.
605 JFW_E_NONE function ran successfully.<br/>
606 JFW_E_INVALIDARG pbEnabled is NULL<br/>
607 JFW_E_ERROR An error occurred.<br/>
608 JFW_E_CONFIGURATION mode was not properly set or their prerequisites
610 JFW_E_DIRECT_MODE the function cannot be used in this mode.
612 JVMFWK_DLLPUBLIC javaFrameworkError
jfw_getEnabled(sal_Bool
*pbEnabled
);
614 /** determines parameters which are passed to VM during its creation.
616 <p>The strings must be exactly as they are passed on the command line.
617 For example, one could pass<br/>
619 -Xrunjdw:transport=dt_socket,server=y,address=8000<br/>
620 in order to enable debugging support.
624 [in] contains the arguments. It can be NULL if nSize is 0.
626 [i] the size of <code>arArgs</code>
629 JFW_E_NONE function ran successfully.<br/>
630 JFW_E_INVALIDARG arArgs is NULL and nSize is not 0
631 JFW_E_ERROR An error occurred.<br/>
632 JFW_E_CONFIGURATION mode was not properly set or their prerequisites
634 JFW_E_DIRECT_MODE the function cannot be used in this mode.
636 JVMFWK_DLLPUBLIC javaFrameworkError
jfw_setVMParameters(
637 rtl_uString
** arArgs
, sal_Int32 nSize
);
639 /** obtains the currently used start parameters.
641 <p>The caller needs to free the returned array with
642 <code>rtl_freeMemory</code>. The contained strings must be released with
643 <code>rtl_uString_release</code>.
647 [out] on returns contains a pointer to the array of the start arguments.
648 If *parParameters is not NULL then the value is overwritten.
650 [out] on return contains the size of array returned in
651 <code>parParameters</code>
654 JFW_E_NONE function ran successfully.<br/>
655 JFW_E_INVALIDARG parParameters or pSize are NULL<br/>
656 JFW_E_ERROR An error occurred.<br/>
657 JFW_E_CONFIGURATION mode was not properly set or their prerequisites
659 JFW_E_DIRECT_MODE the function cannot be used in this mode.
661 JVMFWK_DLLPUBLIC javaFrameworkError
jfw_getVMParameters(
662 rtl_uString
*** parParameters
,
665 /** sets the user class path.
667 <p>When the VM is started then it is passed the class path. The
668 class path also contains the user class path set by this function.
669 The paths contained in <code>pCP</code> must be separated with a
670 system dependent path separator.</p>
673 [in] the user class path.
676 JFW_E_NONE function ran successfully.<br/>
677 JFW_E_INVALIDARG pCP is NULL.<br/>
678 JFW_E_ERROR An error occurred.<br/>
679 JFW_E_CONFIGURATION mode was not properly set or their prerequisites
681 JFW_E_DIRECT_MODE the function cannot be used in this mode.
683 JVMFWK_DLLPUBLIC javaFrameworkError
jfw_setUserClassPath(rtl_uString
* pCP
);
684 /** provides the value of the current user class path.
686 <p>The function returns an empty string if no user class path is set.
690 [out] contains the user class path on return. If <code>*ppCP</code> was
691 not NULL then the value is overwritten. No attempt at freeing that string
695 JFW_E_NONE function ran successfully.<br/>
696 JFW_E_INVALIDARG ppCP is NULL.<br/>
697 JFW_E_ERROR An error occurred.<br/>
698 JFW_E_CONFIGURATION mode was not properly set or their prerequisites
700 JFW_E_DIRECT_MODE the function cannot be used in this mode.
702 JVMFWK_DLLPUBLIC javaFrameworkError
jfw_getUserClassPath(rtl_uString
** ppCP
);
704 /** saves the location of a JRE.
706 <p>When <code>jfw_findAllJREs</code> is called then the paths added by this
707 function are evaluated. If the location still represents a
708 JRE then a <code>JavaInfo</code> object is created which is returned along
709 with all other <code>JavaInfo</code> objects by
710 <code>jfw_findAllJREs</code>. If the location
711 cannot be recognized then the location string is ignored. </p>
713 A validation if <code>sLocation</code> points to a JRE is not
714 performed. To do that one has to use <code>jfw_getJavaInfoByPath</code>.
717 Adding a path that is already stored causes no error.</p>
720 [in] file URL to a directory which contains a JRE.
723 JFW_E_NONE function ran successfully.<br/>
724 JFW_E_INVALIDARG sLocation is NULL.<br/>
725 JFW_E_ERROR An error occurred.<br/>
726 JFW_E_CONFIGURATION mode was not properly set or their prerequisites
728 JFW_E_DIRECT_MODE the function cannot be used in this mode.
730 JVMFWK_DLLPUBLIC javaFrameworkError
jfw_addJRELocation(rtl_uString
* sLocation
);
732 /** checks if the installation of the jre still exists.
734 This function checks if the JRE described by pInfo still
735 exists. The check must be very quick because it is called by javaldx
736 (Linux, Solaris) at start up.
739 [in] the JavaInfo object with information about the JRE.
741 [out] the parameter is set to either sal_True or sal_False. The value is
742 only valid if the function returns JFW_E_NONE.
745 JFW_E_NONE the function ran successfully.</br>
746 JFW_E_ERROR an error occurred during execution.</br>
747 JFW_E_INVALID_ARG pInfo contains invalid data</br>
749 JVMFWK_DLLPUBLIC javaFrameworkError
jfw_existJRE(const JavaInfo
*pInfo
, sal_Bool
*exist
);
752 /** locks this API so that it cannot be used by other threads.
754 <p>If a different thread called this function before then the
755 current call is blocked until the other thread has called
756 <code>jfw_unlock()</code>. The function should be called if one
757 needs an exact snapshot of the current settings. Then the settings
758 are retrieved one by one without risk that the settings may be changed
759 by a different thread. Similiary if one needs to make settings which
760 should become effective at the same time then <code>jfw_lock</code>
761 should be called. That is, <code>jfw_startVM</code> which uses the
762 settings cannot be called before all settings have be made.</p>
764 The only functions which is not effected by <code>jfw_lock</code> is
765 <code>jfw_areEqualJavaInfo</code>.
767 JVMFWK_DLLPUBLIC
void jfw_lock();
769 /** unlocks this API.
771 <p>This function is called after <code>jfw_lock</code>. It allows other
772 threads to use this API concurrently.</p>
774 JVMFWK_DLLPUBLIC
void jfw_unlock();
778 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */