Update git submodules
[LibreOffice.git] / include / jvmfwk / framework.hxx
blob752b6ccc48045b01c14f03226b9e8aebcc462d16
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 .
20 /** @HTML */
22 #ifndef INCLUDED_JVMFWK_FRAMEWORK_HXX
23 #define INCLUDED_JVMFWK_FRAMEWORK_HXX
25 #include <sal/config.h>
27 #include <memory>
28 #include <vector>
30 #include <jvmfwk/jvmfwkdllapi.hxx>
31 #include <rtl/byteseq.hxx>
32 #include <rtl/ustring.hxx>
33 #if defined __clang__
34 #pragma clang diagnostic push
35 #pragma clang diagnostic ignored "-Wunknown-attributes"
36 #endif
37 #include <jni.h>
38 #if defined __clang__
39 #pragma clang diagnostic pop
40 #endif
42 /** @file
43 <p>This library can operate in two modes, application mode and direct mode.</p>
46 <h2>Application Mode</h2>
47 In application mode the Java related settings are stored in files.
48 There are currently three files which need to be accessed. They are determined
49 by bootstrap parameters:</p>
50 <dl>
51 <dt>UNO_JAVA_JFW_VENDOR_SETTINGS</dt>
52 <dd>contains vendor and version information about JREs as well as the
53 location of plugin-libraries which are responsible for providing information
54 about these JREs as well as starting the VMs.</dd>
55 <dt>UNO_JAVA_JFW_USER_DATA</dt>
56 <dd>The file contains settings for a particular user. One can use the macro
57 $SYSUSERCONFIG in the URL which expands to a directory where the user's data are
58 kept. On UNIX this would be the home directory and on Windows some sub-directory
59 of the &quot;Documents and Settings&quot; folder.The content of this file is an
60 implementation detail and may change in the future.</dd>
61 <dt>UNO_JAVA_JFW_SHARED_DATA</dt>
62 <dd>The file contains settings valid for all users. If a user changes a setting
63 then it takes precedence over the setting from UNO_JAVA_JFW_SHARED_DATA.
64 The content of this file is an implementation detail and may change in the future.</dd>
65 </dl>
67 <p>The values for these parameters must be file URLs and include the file name, for
68 example:<br>
69 file:///d:/MyApp/javavendors.xml<br>
70 All files are XML files and must have the extension .xml.</p>
71 <p>
72 Modifying the shared settings is currently not supported by the framework. To provide
73 Java settings for all users one can run OOo and change the settings in the
74 options dialog. These settings are made persistent in the UNO_JAVA_JFW_USER_DATA.
75 The file can then be copied into the base installation.
76 Other users will use automatically these data but can override the settings in
77 the options dialog. This mechanism may change in the future.
78 </p>
79 <p>If shared Java settings are not supported by an application then it is not
80 necessary to specify the bootstrap parameter <code>UNO_JAVA_JFW_SHARED_DATA</code>.
81 </p>
83 <p>Setting the class path used by a Java VM should not be necessary. The locations
84 of Jar files should be known by a class loader. If a jar file depends on another
85 jar file then it can be referenced in the manifest file of the first jar. However,
86 a user may add jars to the class path by using this API. If it becomes necessary
87 to add files to the class path which is to be used by all users then one can use
88 the bootstrap parameter UNO_JAVA_JFW_CLASSPATH_URLS. The value contains of file URLs
89 which must be separated by spaces.</p>
92 <h2>Direct Mode</h2>
94 <p>The direct mode is intended for a scenario where no configuration files
95 are available and a Java VM shall be run. That is,
96 the files containing the user and shared settings are not specified by the
97 bootstrap parameters UNO_JAVA_JFW_SHARED_DATA and UNO_JAVA_JFW_USER_DATA.
98 For example, tools, such as regcomp, may use this framework in a build
99 environment. Then one would want to use settings which have been specified
100 by the build environment. The framework would automatically use the
101 current settings when they change in the environment.
102 </p>
104 <p> Here are examples how regcomp could be invoked using bootstrap parameters:
105 </p>
107 regcomp -env:UNO_JAVA_JFW_JREHOME=file:///d:/j2re1.4.2
108 -env:&quot;UNO_JAVA_JFW_CLASSPATH=d:\\solver\\bin\\classes.jar;d:\\solver\\bin\\libreoffice.jar&quot;
109 -register...
110 </p>
111 <p>If UNO_JAVA_JFW_VENDOR_SETTINGS is not set then a plugin library must be specified. For example:</p>
113 regcomp -env:UNO_JAVA_JFW_JREHOME=file:///d:/j2re1.4.2
114 -env:&quot;UNO_JAVA_JFW_CLASSPATH=d:\\solver\\bin\\classes.jar;d:\\solver\\bin\\libreoffice.jar&quot;
115 -register...
116 </p>
117 <p>Additional parameters for the Java VM can be provided. For every parameter
118 a separate bootstrap parameter must be specified. The names are
119 <code>UNO_JAVA_JFW_PARAMETER_X</code>, where X is 1,2, .. n. For example:</p>
121 regcomp -env:UNO_JAVA_JFW_PARAMETER_1=-Xdebug
122 -env:UNO_JAVA_JFW_PARAMETER_2=-Xrunjdwp:transport=dt_socket,server=y,address=8100
123 -env:UNO_JAVA_JFW_JREHOME=file:///d:/j2re1.4.2
124 -env:&quot;UNO_JAVA_JFW_CLASSPATH=d:\\solver\\bin\\classes.jar;d:\\solver\\bin\\libreoffice.jar&quot;
125 -register...</p>
127 Here is a complete list of the bootstrap parameter for the direct mode:
128 </p>
129 <dl>
130 <dt>UNO_JAVA_JFW_JREHOME</dt>
131 <dd>Specifies a file URL to a JRE installation.It must ALWAYS be specified
132 in direct mode</dd>
133 <dt>UNO_JAVA_JFW_ENV_JREHOME</dt>
134 <dd>Setting this parameter, for example to &quot;1&quot; or &quot;true&quot;,
135 causes the framework to use the environment variable JAVA_HOME. It is expected
136 that JAVA_HOME contains a system path rather than a file URL. This parameter
137 and UNO_JAVA_JFW_JREHOME are mutually exclusive</dd>
138 <dt>UNO_JAVA_JFW_CLASSPATH</dt>
139 <dd>Contains the class path which is to be used by the VM. Special character,
140 such as '\','{','}','$' must be preceded with '\'. See documentation about the
141 bootstrap parameter.</dd>
142 <dt>UNO_JAVA_JFW_ENV_CLASSPATH</dt>
143 <dd>Setting this parameter,for example to &quot;1&quot; or &quot;true&quot;,
144 causes the framework to use the
145 environment variable CLASSPATH. If this variable and UNO_JAVA_JFW_CLASSPATH are
146 set then the class path is composed from UNO_JAVA_JFW_CLASSPATH and the environment
147 variable CLASSPATH.</dd>
148 <dt>UNO_JAVA_JFW_PARAMETER_X</dt>
149 <dd>Specifies a parameter for the Java VM. The X is replaced by
150 non-negative natural numbers starting with 1.</dd>
151 </dl>
153 <p>A note about bootstrap parameters. The implementation of the bootstrap
154 parameter mechanism interprets the characters '\', '$', '{', '}' as
155 escape characters. That's why the Windows path contain double back-slashes.
156 One should also take into account that a console may have also special
157 escape characters.</p>
159 <h2>What mode is used</h2>
161 The default mode is application mode. If at least one bootstrap parameter
162 for the direct mode is provided then direct mode is used. </p>
165 All settings made by this API are done for the current user if not
166 mentioned differently.</p>
169 /** indicates that there must be an environment set up before the Java process
170 runs.
171 <p>Therefore, when a Java is selected in OO then the office must be
172 restarted, so that the changes can take effect.</p>
174 #define JFW_REQUIRE_NEEDRESTART 0x1l
176 /** error codes which are returned by functions of this API.
178 enum javaFrameworkError
180 JFW_E_NONE,
181 JFW_E_ERROR,
182 JFW_E_NO_SELECT,
183 JFW_E_INVALID_SETTINGS,
184 JFW_E_NEED_RESTART,
185 JFW_E_RUNNING_JVM,
186 JFW_E_JAVA_DISABLED,
187 JFW_E_NOT_RECOGNIZED,
188 JFW_E_FAILED_VERSION,
189 JFW_E_NO_JAVA_FOUND,
190 JFW_E_VM_CREATION_FAILED,
191 JFW_E_CONFIGURATION,
192 JFW_E_DIRECT_MODE
195 /** an instance of this struct represents an installation of a Java
196 Runtime Environment (JRE).
199 Instances of this struct are created by the plug-in libraries which are used by
200 this framework (jvmfwk/vendorplugin.h).</p>
202 struct JavaInfo
204 /** contains the vendor.
206 <p>string must be the same as the one obtained from the
207 Java system property <code>java.vendor</code>.
208 </p>
210 OUString sVendor;
211 /** contains the file URL to the installation directory.
213 OUString sLocation;
214 /** contains the version of this Java distribution.
216 <p>The version string must adhere to the rules
217 about how a version string has to be formed. These rules may
218 be vendor-dependent. Essentially the strings must syntactically
219 equal the Java system property <code>java.version</code>.
220 </p>
222 OUString sVersion;
223 /** indicates requirements for running the java runtime.
225 <p>For example, it may be necessary to prepare the environment before
226 the runtime is created. That could mean, setting the
227 <code>LD_LIBRARY_PATH</code>
228 when <code>nRequirements</code> contains the flag
229 <code>JFW_REQUIRE_NEEDRESTART</code></p>
231 sal_uInt64 nRequirements;
232 /** contains data needed for the creation of the java runtime.
234 <p>There is no rule about the format and content of the sequence's
235 values. The plug-in libraries can put all data, necessary for
236 starting the java runtime into this sequence. </p>
238 rtl::ByteSequence arVendorData;
241 /** compares two <code>JavaInfo</code> objects for equality.
243 <p>Two <code>JavaInfo</code> objects are said to be equal if the contained
244 members of the first <code>JavaInfo</code> are equal to their counterparts
245 in the second <code>JavaInfo</code> object. The equality of the
246 <code>OUString</code> members is determined
247 by <code>operator ==</code>.
248 Similarly the equality of the <code>rtl::ByteSequence</code> is
249 also determined by a comparison
250 function (see <code>rtl::ByteSequence::operator ==</code>). </p>
252 Both argument pointers must be valid.</p>
253 @param pInfoA
254 the first argument.
255 @param pInfoB
256 the second argument which is compared with the first.
257 @return
258 true - both object represent the same JRE.</br>
259 false - the objects represent different JREs
261 JVMFWK_DLLPUBLIC bool jfw_areEqualJavaInfo(JavaInfo const* pInfoA, JavaInfo const* pInfoB);
263 /** determines if a Java Virtual Machine is already running.
265 <p>As long as the office and the JREs only support one
266 Virtual Machine per process the Java settings, particularly the
267 selected Java, are not effective immediately after changing when
268 a VM has already been running. That is, if a JRE A was used to start
269 a VM and then a JRE B is selected, then JRE B will only be used
270 after a restart of the office.</p>
272 By determining if a VM is running, the user can be presented a message,
273 that the changed setting may not be effective immediately.</p>
275 @return
276 true iff a VM is running.
278 JVMFWK_DLLPUBLIC bool jfw_isVMRunning();
280 /** detects a suitable JRE and configures the framework to use it.
282 <p>Which JREs can be used is determined by the file javavendors.xml,
283 which contains version requirements.</p>
285 JREs can be provided by different vendors.
286 The function obtains information about JRE installations. If none was
287 found then it also uses a list of paths, which have been registered
288 by <code>jfw_addJRELocation</code>
289 to find JREs. Found JREs are examined in the same way.</p>
291 A JRE installation is only selected if it meets the version requirements.
292 Information about the selected JRE are made persistent so that
293 subsequent calls to <code>jfw_getSelectedJRE</code> returns this
294 information.</p>
296 While determining a proper JRE this function takes into account if a
297 user requires support for assistive technology tools. If user
298 need that support they have to set up their system accordingly.</p>
300 If the JAVA_HOME environment variable is set, this function prefers
301 the JRE which the variable refers to over other JREs.
302 If JAVA_HOME is not set or does not refer to a suitable JRE,
303 the PATH environment variable is inspected and the respective JREs
304 are checked for their suitability next.</p>
306 The first <code>JavaInfo</code> object that is detected by the algorithm
307 as described above is used.</p>
309 @param pInfo
310 [out] a <code>JavaInfo</code> pointer, representing the selected JRE.
311 The <code>JavaInfo</code> is for informational purposes only. It is not
312 necessary to call <code>jfw_setSelectedJRE</code> afterwards.<br/>
313 <code>pInfo</code>can be NULL.
315 @return
316 JFW_E_NONE function ran successfully.<br/>
317 JFW_E_ERROR an error occurred. <br/>
318 JFW_E_NO_JAVA_FOUND no JRE was found that meets the requirements.</br>
319 JFW_E_DIRECT_MODE the function cannot be used in this mode. </br>
320 JFW_E_CONFIGURATION mode was not properly set or their prerequisites
321 were not met.
323 JVMFWK_DLLPUBLIC javaFrameworkError jfw_findAndSelectJRE(std::unique_ptr<JavaInfo>* pInfo);
325 /** provides information about all available JRE installations.
327 <p>The function determines dynamically what JREs are available. It uses
328 the plug-in libraries to provide lists of available <code>JavaInfo</code>
329 objects where each object represents a JRE (see vendorplugin.h,
330 getAllJavaInfos). It also uses a list of paths, which have been registered
331 by <code>jfw_addJRELocation</code>.
332 It is checked if the path still contains a valid JRE and if so the respective
333 <code>JavaInfo</code> object will be appended to the array unless there is
334 already an equal object.</p>
336 @param parInfo
337 [out] on returns it contains a vector of <code>JavaInfo</code> pointers.
339 @return
340 JFW_E_NONE function ran successfully.<br/>
341 JFW_E_ERROR an error occurred. <br/>
342 JFW_E_CONFIGURATION mode was not properly set or their prerequisites
343 were not met.
345 JVMFWK_DLLPUBLIC javaFrameworkError
346 jfw_findAllJREs(std::vector<std::unique_ptr<JavaInfo>>* parInfo);
349 * Convert colon-separated userClassPath which might contain bootstrap variables
350 * (which also might contain colons) to a list of classPaths, keeping bootstrap variables intact.
352 * FIXME: Nested or multiple occurrences of ${...:...:...} are currently not supported.
354 * @param sUserPath colon-separated string of user classpaths
355 * @return list of user classpaths
357 JVMFWK_DLLPUBLIC std::vector<OUString> jfw_convertUserPathList(std::u16string_view sUserPath);
359 /** determines if a path points to a Java installation.
361 <p>If the path belongs to a JRE installation then it returns the
362 respective <code>JavaInfo</code> object. The function uses the
363 <code>getJavaInfoByPath</code> function of the plug-ins to obtain the
364 <code>JavaInfo</code> object. Only if the JRE found at the specified location
365 meets the version requirements as specified in the javavendors.xml file a
366 <code>JavaInfo</code> object is returned.<br/>
368 The functions only checks if a JRE exists but does not modify any settings.
369 To make the found JRE the &quot;selected JRE&quot; one has
370 to call <code>jfw_setSelectedJRE</code>.</p>
372 @param pPath
373 [in] a file URL to a directory.
374 @param ppInfo
375 [out] the <code>JavaInfo</code> object which represents a JRE found at the
376 location specified by <code>pPath</code>
378 @return
379 JFW_E_NONE function ran successfully.<br/>
380 JFW_E_ERROR an error occurred. <br/>
381 JFW_E_CONFIGURATION mode was not properly set or their prerequisites
382 were not met.</br>
383 JFW_E_NOT_RECOGNIZED neither plug-in library could detect a JRE. <br/>
384 JFW_E_FAILED_VERSION a JRE was detected but if failed the version
385 requirements as determined by the javavendors.xml
387 JVMFWK_DLLPUBLIC javaFrameworkError jfw_getJavaInfoByPath(OUString const& pPath,
388 std::unique_ptr<JavaInfo>* ppInfo);
390 /** starts a Java Virtual Machine (JVM).
392 <p>The function uses the current settings to start a JVM. The actual
393 start-up code, however, is provided by the plug-in libraries. The setting
394 of the &quot;selected Java&quot; contains the information as to what vendor
395 the respective JRE comes from. In the javavendors.xml there is a mapping of
396 vendor names to the respective plug-in libraries.</p>
398 The function ultimately calls <code>startJavaVirtualMachine</code> from
399 the plug-in library.</p>
401 The <code>arOptions</code>
402 argument contains start arguments which are passed in JavaVMOption structures
403 to the VM during its creation. These
404 could be things, such as language and locale settings, proxy settings or any other
405 properties which shall be obtainable by
406 <code>java.lang.System.getProperties</code>. One can also pass options which
407 have a certain meaning to the runtime behaviour such as -ea or -X... However,
408 one must be sure that these options can be interpreted by the VM.<br/>
409 The class path cannot be set this way. The class path is internally composed by
410 the paths to archives in a certain directory, which is preconfigured in
411 the internal data store and the respective user setting (see
412 <code>jfw_setUserClassPath</code>.</p>
414 If a JRE was selected at runtime which was different from the previous
415 setting and that JRE needs a prepared environment, for example an adapted
416 <code>LD_LIBRARY_PATH</code> environment variable, then the VM will not be
417 created and JFW_E_NEED_RESTART error is returned. If a VM is already running
418 then a JFW_E_RUNNING_JVM is returned.</p>
420 @param pInfo
421 [in] optional pointer to a specific JRE; must be caller-freed if not NULL
422 @param arOptions
423 [in] the vector containing additional start arguments.
424 @param ppVM
425 [out] the <code>JavaVM</code> pointer.
426 @param ppEnv
427 [out] the <code>JNIenv</code> pointer.
429 @return
430 JFW_E_NONE function ran successfully.<br/>
431 JFW_E_ERROR an error occurred. <br/>
432 JFW_E_CONFIGURATION mode was not properly set or their prerequisites
433 were not met.</br>
434 JFW_E_JAVA_DISABLED the use of Java is currently disabled. <br/>
435 JFW_E_NO_SELECT there is no JRE selected yet. <br/>
436 JFW_E_RUNNING_JVM there is already a VM running.<br/>
437 JFW_E_INVALID_SETTINGS the javavendors.xml has been changed and no
438 JRE has been selected afterwards. <br/>
439 JFW_E_NEED_RESTART in the current process a different JRE has been selected
440 which needs a prepared environment, which has to be done before the office
441 process. Therefore the new JRE may not be used until the office was restarted.<br/>
442 JFW_E_NEED_RESTART is also returned when Java was disabled at the beginning and
443 then the user enabled it. If then the selected JRE has the requirement
444 JFW_REQUIRE_NEEDRESTART then this error is returned. </br>
445 JFW_E_VM_CREATION_FAILED the creation of the JVM failed. The creation is performed
446 by a plug-in library and not by this API.
447 JFW_E_FAILED_VERSION the &quot;Default Mode&quot; is active. The JRE determined by
448 <code>JAVA_HOME</code>does not meet the version requirements.
450 JVMFWK_DLLPUBLIC javaFrameworkError jfw_startVM(JavaInfo const* pInfo,
451 std::vector<OUString> const& arOptions,
452 JavaVM** ppVM, JNIEnv** ppEnv);
454 /** determines the JRE that is to be used.
456 <p>When calling <code>jfw_startVM</code> then a VM is started from
457 the JRE that is determined by this function.<br/>
458 It is not verified if the JRE represented by the <code>JavaInfo</code>
459 argument meets the requirements as specified by the javavendors.xml file.
460 However, usually one obtains the <code>JavaInfo</code> object from the
461 functions <code>jfw_findAllJREs</code> or <code>jfw_getJavaInfoByPath</code>,
462 which do verify the JREs and pass out only <code>JavaInfo</code> objects
463 which comply with the version requirements.</p>
465 If <code>pInfo</code> is NULL then the meaning is that no JRE will be
466 selected. <code>jfw_startVM</code> will then return
467 <code>JFW_E_NO_SELECT</code>.</p>
469 @param pInfo
470 [in] pointer to <code>JavaInfo</code> structure, containing data about a
471 JRE. The caller must still free <code>pInfo</code>.
473 @return
474 JFW_E_NONE function ran successfully.<br/>
475 JFW_E_ERROR An error occurred.<br/>
476 JFW_E_CONFIGURATION mode was not properly set or their prerequisites
477 were not met.<br/>
478 JFW_E_DIRECT_MODE the function cannot be used in this mode.
480 JVMFWK_DLLPUBLIC javaFrameworkError jfw_setSelectedJRE(JavaInfo const* pInfo);
482 /** provides information about the JRE that is to be used.
484 <p>If no JRE is currently selected then <code>ppInfo</code> will contain
485 NULL on return.</br>
486 If the value of the element <updated> in the javavendors.xml file was
487 changed since the time when the last Java was selected then this
488 function returns <code>JFW_E_INVALID_SETTINGS</code>. This could happen during
489 a product patch. Then new version requirements may be introduced, so that
490 the currently selected JRE may not meet these requirements anymore.
491 </p>
492 <p>In direct mode the function returns information about a JRE that was
493 set by the bootstrap parameter UNO_JAVA_JFW_JREHOME.
494 </p>
495 @param ppInfo
496 [out] on return it contains a pointer to a <code>JavaInfo</code> object
497 that represents the currently selected JRE. When <code>*ppInfo</code> is not
498 NULL then the function sets the pointer.
500 @return
501 JFW_E_NONE function ran successfully.<br/>
502 JFW_E_CONFIGURATION mode was not properly set or their prerequisites
503 were not met.<br/>
504 JFW_E_INVALID_SETTINGS the javavendors.xml has been changed and no
505 JRE has been selected afterwards. <br/>
507 JVMFWK_DLLPUBLIC javaFrameworkError jfw_getSelectedJRE(std::unique_ptr<JavaInfo>* ppInfo);
509 /** determines if Java can be used.
511 <p>If <code>bEnabled</code> is <code>false</code> then a call
512 to jfw_startVM will result in an error with the errorcode
513 <code>JFW_E_JAVA_DISABLED</code></p>
515 @param bEnabled
516 [in] use of Java enabled/disabled.
518 @return
519 JFW_E_NONE function ran successfully.<br/>
520 JFW_E_ERROR An error occurred.<br/>
521 JFW_E_CONFIGURATION mode was not properly set or their prerequisites
522 were not met.<br/>
523 JFW_E_DIRECT_MODE the function cannot be used in this mode.
525 JVMFWK_DLLPUBLIC javaFrameworkError jfw_setEnabled(bool bEnabled);
527 /** provides the information if Java can be used.
529 <p>That is if the user enabled or disabled the use of Java.
530 </p>
532 @return
533 JFW_E_NONE function ran successfully.<br/>
534 JFW_E_ERROR An error occurred.<br/>
535 JFW_E_CONFIGURATION mode was not properly set or their prerequisites
536 were not met.<br/>
537 JFW_E_DIRECT_MODE the function cannot be used in this mode.
539 JVMFWK_DLLPUBLIC javaFrameworkError jfw_getEnabled(bool* pbEnabled);
541 /** determines parameters which are passed to VM during its creation.
543 <p>The strings must be exactly as they are passed on the command line.
544 For example, one could pass<br/>
545 -Xdebug <br/>
546 -Xrunjdw:transport=dt_socket,server=y,address=8000<br/>
547 in order to enable debugging support.
548 </p>
550 @param arParameters
551 [in] contains the arguments.
553 @return
554 JFW_E_NONE function ran successfully.<br/>
555 JFW_E_ERROR An error occurred.<br/>
556 JFW_E_CONFIGURATION mode was not properly set or their prerequisites
557 were not met.<br/>
558 JFW_E_DIRECT_MODE the function cannot be used in this mode.
560 JVMFWK_DLLPUBLIC javaFrameworkError jfw_setVMParameters(std::vector<OUString> const& arArgs);
562 /** obtains the currently used start parameters.
564 @param parParameters
565 [out] on returns contains a pointer to the array of the start arguments.
567 @return
568 JFW_E_NONE function ran successfully.<br/>
569 JFW_E_ERROR An error occurred.<br/>
570 JFW_E_CONFIGURATION mode was not properly set or their prerequisites
571 were not met.<br/>
572 JFW_E_DIRECT_MODE the function cannot be used in this mode.
574 JVMFWK_DLLPUBLIC javaFrameworkError jfw_getVMParameters(std::vector<OUString>* parParameters);
576 /** sets the user class path.
578 <p>When the VM is started then it is passed the class path. The
579 class path also contains the user class path set by this function.
580 The paths contained in <code>pCP</code> must be separated with a
581 system dependent path separator.</p>
583 @param pCP
584 [in] the user class path.
586 @return
587 JFW_E_NONE function ran successfully.<br/>
588 JFW_E_ERROR An error occurred.<br/>
589 JFW_E_CONFIGURATION mode was not properly set or their prerequisites
590 were not met.<br/>
591 JFW_E_DIRECT_MODE the function cannot be used in this mode.
593 JVMFWK_DLLPUBLIC javaFrameworkError jfw_setUserClassPath(OUString const& pCP);
594 /** provides the value of the current user class path.
596 <p>The function returns an empty string if no user class path is set.
597 </p>
599 @param ppCP
600 [out] contains the user class path on return.
602 @return
603 JFW_E_NONE function ran successfully.<br/>
604 JFW_E_ERROR An error occurred.<br/>
605 JFW_E_CONFIGURATION mode was not properly set or their prerequisites
606 were not met.<br/>
607 JFW_E_DIRECT_MODE the function cannot be used in this mode.
609 JVMFWK_DLLPUBLIC javaFrameworkError jfw_getUserClassPath(OUString* ppCP);
611 /** saves the location of a JRE.
613 <p>When <code>jfw_findAllJREs</code> is called then the paths added by this
614 function are evaluated. If the location still represents a
615 JRE then a <code>JavaInfo</code> object is created which is returned along
616 with all other <code>JavaInfo</code> objects by
617 <code>jfw_findAllJREs</code>. If the location
618 cannot be recognized then the location string is ignored. </p>
620 A validation if <code>sLocation</code> points to a JRE is not
621 performed. To do that one has to use <code>jfw_getJavaInfoByPath</code>.
622 </p>
624 Adding a path that is already stored causes no error.</p>
626 @param sLocation
627 [in] file URL to a directory which contains a JRE.
629 @return
630 JFW_E_NONE function ran successfully.<br/>
631 JFW_E_ERROR An error occurred.<br/>
632 JFW_E_CONFIGURATION mode was not properly set or their prerequisites
633 were not met.<br/>
634 JFW_E_DIRECT_MODE the function cannot be used in this mode.
636 JVMFWK_DLLPUBLIC javaFrameworkError jfw_addJRELocation(OUString const& sLocation);
638 /** checks if the installation of the jre still exists.
640 This function checks if the JRE described by pInfo still
641 exists. The check must be very quick because it is called by javaldx
642 (Linux, Solaris) at start up.
644 @param pInfo
645 [in] the JavaInfo object with information about the JRE.
646 @param pp_exist
647 [out] the parameter is set to either true or false. The value is
648 only valid if the function returns JFW_E_NONE.
650 @return
651 JFW_E_NONE the function ran successfully.</br>
652 JFW_E_ERROR an error occurred during execution.</br>
654 JVMFWK_DLLPUBLIC javaFrameworkError jfw_existJRE(const JavaInfo* pInfo, bool* exist);
656 /** locks this API so that it cannot be used by other threads.
658 <p>If a different thread called this function before then the
659 current call is blocked until the other thread has called
660 <code>jfw_unlock()</code>. The function should be called if one
661 needs an exact snapshot of the current settings. Then the settings
662 are retrieved one by one without risk that the settings may be changed
663 by a different thread. Similarity if one needs to make settings which
664 should become effective at the same time then <code>jfw_lock</code>
665 should be called. That is, <code>jfw_startVM</code> which uses the
666 settings cannot be called before all settings have be made.</p>
668 The only functions which is not effected by <code>jfw_lock</code> is
669 <code>jfw_areEqualJavaInfo</code>.
671 JVMFWK_DLLPUBLIC void jfw_lock();
673 /** unlocks this API.
675 <p>This function is called after <code>jfw_lock</code>. It allows other
676 threads to use this API concurrently.</p>
678 JVMFWK_DLLPUBLIC void jfw_unlock();
680 #endif
682 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */