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_H
23 #define INCLUDED_JVMFWK_FRAMEWORK_H
25 #include "jvmfwkdllapi.h"
26 #include "rtl/ustring.h"
27 #include "osl/mutex.h"
35 <p>This library can operate in two modes, application mode and direct mode.</p>
38 <h2>Application Mode</h2>
39 In application mode the Java related settings are stored in files.
40 There are currently three files which need to be accessed. They are determined
41 by bootstrap parameters:</p>
43 <dt>UNO_JAVA_JFW_VENDOR_SETTINGS</dt>
44 <dd>contains vendor and version information about JREs as well as the
45 location of plugin-libraries which are responsible for providing information
46 about these JREs as well as starting the VMs.</dd>
47 <dt>UNO_JAVA_JFW_USER_DATA</dt>
48 <dd>The file contains settings for a particular user. One can use the macro
49 $SYSUSERCONFIG in the URL which expands to a directory whery the user's data are
50 kept. On UNIX this would be the home directory and on Windows some sub-directory
51 of the "Documents and Settings" folder.The content of this file is an
52 implementation detail and may change in the future.</dd>
53 <dt>UNO_JAVA_JFW_SHARED_DATA</dt>
54 <dd>The file contains settings valid for all users. If a user changes a setting
55 then it takes precedence over the setting from UNO_JAVA_JFW_SHARED_DATA.
56 The content of this file is an implementation detail and may change in the future.</dd>
59 <p>The values for these parameters must be file URLs and include the file name, for
61 file:///d:/MyApp/javavendors.xml<br>
62 All files are XML files and must have the extension .xml.</p>
64 Modifying the shared settings is currently not supported by the framework. To provide
65 Java settings for all users one can run OOo and change the settings in the
66 options dialog. These settings are made persistent in the UNO_JAVA_JFW_USER_DATA.
67 The file can then be copied into the base installation.
68 Other users will use automatically these data but can override the settings in
69 the options dialog. This mechanism may change in the future.
71 <p>If shared Java settings are not supported by an application then it is not
72 necessary to specify the bootstrap parameter <code>UNO_JAVA_JFW_SHARED_DATA</code>.
75 <p>Setting the class path used by a Java VM should not be necesarry. The locations
76 of Jar files should be knows by a class loader. If a jar file depends on another
77 jar file then it can be referenced in the manifest file of the first jar. However,
78 a user may add jars to the class path by using this API. If it becomes necessary
79 to add files to the class path which is to be used by all users then one can use
80 the bootrap parameter UNO_JAVA_JFW_CLASSPATH_URLS. The value contains of file URLs
81 which must be separated by spaces.</p>
86 <p>The direct mode is intended for a scenario where no configuration files
87 are available and a Java VM shall be run. That is,
88 the files containing the user and shared settings are not specified by the
89 bootstrap parameters UNO_JAVA_JFW_SHARED_DATA and UNO_JAVA_JFW_USER_DATA.
90 For example, tools, such as regcomp, may use this framework in a build
91 environment. Then one would want to use settings which have been specified
92 by the build environment. The framework would automatically use the
93 current settings when they change in the environment.
96 <p> Here are examples how regcomp could be invoked using bootstrap parameters:
99 regcomp -env:UNO_JAVA_JFW_JREHOME=file:///d:/j2re1.4.2
100 -env:"UNO_JAVA_JFW_CLASSPATH=d:\\solver\\bin\\classes.jar;d:\\solver\\bin\\jurt.jar"
103 <p>If UNO_JAVA_JFW_VENDOR_SETTINGS is not set then a plugin library must be specified. For example:</p>
105 regcomp -env:UNO_JAVA_JFW_JREHOME=file:///d:/j2re1.4.2
106 -env:"UNO_JAVA_JFW_CLASSPATH=d:\\solver\\bin\\classes.jar;d:\\solver\\bin\\jurt.jar"
107 -env:UNO_JAVA_JFW_PLUGIN=file:\\solver\\bin\\libsunjavaplugin.dll -register ....
109 <p>Additionall parameters for the Java VM can be provided. For every parameter
110 a separate bootstrap parameter must be specified. The names are
111 <code>UNO_JAVA_JFW_PARAMETER_X</code>, where X is 1,2, .. n. For example:</p>
113 regcomp -env:UNO_JAVA_JFW_PARAMETER_1=-Xdebug
114 -env:UNO_JAVA_JFW_PARAMETER_2=-Xrunjdwp:transport=dt_socket,server=y,address=8100
115 -env:UNO_JAVA_JFW_JREHOME=file:///d:/j2re1.4.2
116 -env:"UNO_JAVA_JFW_CLASSPATH=d:\\solver\\bin\\classes.jar;d:\\solver\\bin\\jurt.jar"
119 Here is a complete list of the bootstrap parameter for the direct mode:
122 <dt>UNO_JAVA_JFW_JREHOME</dt>
123 <dd>Specifies a file URL to a JRE installation.It must ALWAYS be specified
125 <dt>UNO_JAVA_JFW_ENV_JREHOME</dt>
126 <dd>Setting this parameter, for example to "1" or "true",
127 causes the framework to use the environment variable JAVA_HOME. It is expected
128 that JAVA_HOME contains a system path rather than a file URL. This parameter
129 and UNO_JAVA_JFW_JREHOME are mutually exclusive</dd>
130 <dt>UNO_JAVA_JFW_CLASSPATH</dt>
131 <dd>Contains the class path which is to be used by the VM. Special character,
132 such as '\','{','}','$' must be preceded with '\'. See documentation about the
133 bootstrap parameter.</dd>
134 <dt>UNO_JAVA_JFW_ENV_CLASSPATH</dt>
135 <dd>Setting this parameter,for example to "1" or "true",
136 causes the framework to use the
137 environment variable CLASSPATH. If this variable and UNO_JAVA_JFW_CLASSPATH are
138 set then the class path is composed from UNO_JAVA_JFW_CLASSPATH and the environment
139 variable CLASSPATH.</dd>
140 <dt>UNO_JAVA_JFW_PLUGIN</dt>
141 <dd>Specified a file URL to a plugin library. If this variable is provided
142 then a javavendors.xml is ignored. It must be provided if no
143 javavendors.xml is available.</dd>
144 <dt>UNO_JAVA_JFW_PARAMETER_X</dt>
145 <dd>Specifies a parameter for the Java VM. The X is replaced by
146 non-negative natural numbers starting with 1.</dd>
149 <p>A note about bootstrap parameters. The implementation of the bootstrap
150 parameter mechanism interprets the characters '\', '$', '{', '}' as
151 escape characters. Thats why the Windows path contain double back-slashes.
152 One should also take into account that a console may have also special
153 escape characters.</p>
155 <h2>What mode is used</h2>
157 The default mode is application mode. If at least one bootstrap parameter
158 for the direct mode is provided then direct mode is used. </p>
161 All settings made by this API are done for the current user if not
162 mentioned differently.</p>
164 <h2>Other bootstrap variables</h2>
166 <dt>JFW_PLUGIN_DO_NOT_CHECK_ACCESSIBILITY</dt>
167 <dd>This is a unofficial variable which was introduced to workaround external issues.
168 It may be removed in the future. By setting it to 1, the framework will not try to
169 find out if the system is configured to use accessibility tools or if a JRE has an
170 accessibiliy bridge installed</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 typedef enum _javaFrameworkError
194 JFW_E_INVALID_SETTINGS
,
199 JFW_E_NOT_RECOGNIZED
,
200 JFW_E_FAILED_VERSION
,
202 JFW_E_VM_CREATION_FAILED
,
205 } javaFrameworkError
;
207 /** an instance of this struct represents an installation of a Java
208 Runtime Environment (JRE).
211 Instances of this struct are created by the plug-in libraries which are used by
212 this framework (jvmfwk/vendorplugin.h). The memory of the instances is created
213 by <code>rtl_allocateMemory</code> (rtl/alloc.h). Therefore, the memory must
214 be freed by <code>rtl_freeMemory</code>. Also the contained members must be
216 For convenience this API provides the function <code>jfw_freeJavaInfo</code>
217 which frees the objects properly. </p>
221 /** contains the vendor.
223 <p>string must be the same as the one obtained from the
224 Java system property <code>java.vendor</code>.
227 rtl_uString
*sVendor
;
228 /** contains the file URL to the installation directory.
230 rtl_uString
*sLocation
;
231 /** contains the version of this Java distribution.
233 <p>The version string must adhere to the rules
234 about how a version string has to be formed. These rules may
235 be vendor-dependent. Essentially the strings must syntactically
236 equal the Java system property <code>java.version</code>.
239 rtl_uString
*sVersion
;
240 /** indicates supported special features.
242 <p>For example, <code>JFW_FEATURE_ACCESSBRIDGE</code> indicates that
243 assistive technology tools are supported.</p>
245 sal_uInt64 nFeatures
;
246 /** indicates requirments for running the java runtime.
248 <p>For example, it may be necessary to prepare the environment before
249 the runtime is created. That could mean, setting the
250 <code>LD_LIBRARY_PATH</code>
251 when <code>nRequirements</code> contains the flag
252 <code>JFW_REQUIRE_NEEDRESTART</code></p>
254 sal_uInt64 nRequirements
;
255 /** contains data needed for the creation of the java runtime.
257 <p>There is no rule about the format and content of the sequence's
258 values. The plug-in libraries can put all data, necessary for
259 starting the java runtime into this sequence. </p>
261 sal_Sequence
* arVendorData
;
264 typedef struct _JavaInfo JavaInfo
;
266 /** frees the memory of a <code>JavaInfo</code> object.
268 The object which is to be freed. It can be NULL;
270 JVMFWK_DLLPUBLIC
void SAL_CALL
jfw_freeJavaInfo(JavaInfo
*pInfo
);
273 /** compares two <code>JavaInfo</code> objects for equality.
275 <p>Two <code>JavaInfo</code> objects are said to be equal if the contained
276 members of the first <code>JavaInfo</code> are equal to their counterparts
277 in the second <code>JavaInfo</code> object. The equality of the
278 <code>rtl_uString</code> members is determined
279 by the respective comparison function (see
280 <code>OUString::equals</code>).
281 Similiarly the equality of the <code>sal_Sequence</code> is
282 also determined by a comparison
283 function (see <code>rtl::ByteSequence::operator ==</code>). </p>
285 Both argument pointers must be valid.</p>
289 the second argument which is compared with the first.
291 sal_True - both object represent the same JRE.</br>
292 sal_False - the objects represend different JREs
294 JVMFWK_DLLPUBLIC sal_Bool SAL_CALL
jfw_areEqualJavaInfo(
295 JavaInfo
const * pInfoA
,JavaInfo
const * pInfoB
);
297 /** determines if a Java Virtual Machine is already running.
299 <p>As long as the office and the JREs only support one
300 Virtual Machine per process the Java settings, particulary the
301 selected Java, are not effective immediately after changing when
302 a VM has already been running. That is, if a JRE A was used to start
303 a VM and then a JRE B is selected, then JRE B will only be used
304 after a restart of the office.</p>
306 By determining if a VM is running, the user can be presented a message,
307 that the changed setting may not be effective immediately.</p>
310 [out] sal_True - a VM is running. <br/>
311 sal_False - no VM is running.
314 JFW_E_NONE function ran successfully.<br/>
315 JFW_E_INVALID_ARG the parameter <code>bRunning</code> was NULL.
317 JVMFWK_DLLPUBLIC javaFrameworkError SAL_CALL
jfw_isVMRunning(sal_Bool
*bRunning
);
319 /** detects a suitable JRE and configures the framework to use it.
321 <p>Which JREs can be used is determined by the file javavendors.xml,
322 which contains version requirements, as well as information about available
323 plug-in libraries. Only these libraries are responsible for locating JRE
326 JREs can be provided by different vendors. In order to find the JREs of
327 a certain vendor a plug-in library must be provided. There must be only one
328 library for one vendor. The names of locations of those libraries have to
329 be put into the javavendors.xml file.<br/>
330 The function uses the plug-in libraries to obtain information about JRE
331 installation and checks if they there is one among them that supports
332 a set of features (currently only accessibilty is possible). If none was
333 found then it also uses a list of paths, which have been registered
334 by <code>jfw_addJRELocation</code> or <code>jfw_setJRELocations</code>
335 to find JREs. Found JREs are examined in the same way.</p>
337 A JRE installation is only selected if it meets the version requirements.
338 Information about the selected JRE are made persistent so that
339 subsequent calls to <code>jfw_getSelectedJRE</code> returns this
342 While determining a proper JRE this function takes into account if a
343 user requires support for assistive technology tools. If user
344 need that support they have to set up their system accordingly. When support
345 for assistive technology is required, then the lists of
346 <code>JavaInfo</code> objects,
347 which are provided by the <code>getJavaInfo</code> functions of the plug-ins, are
348 examined for a suitable JRE. That is, the <code>JavaInfo</code> objects
350 obtained from the first plug-in, are examined. If no <code>JavaInfo</code>
352 <code>JFW_FEATURE_ACCESSBRIDGE</code> in the member <code>nFeatures</code>
354 next plug-in is used to obtain a list of <code>JavaInfo</code> objects.
355 This goes on until a <code>JavaInfo</code> object was found which
356 represents a suitable JRE. Or neither plug-in provided such a
357 <code>JavaInfo</code> object. In that case the first
358 <code>JavaInfo</code> object from the first plug-in is used to determine
359 the JRE which is to be used.</p>
361 If there is no need for the support of assistive technology tools then
362 the first <code>JavaInfo</code> object from the list obtained by the
363 first plug-in is used. If this plug-in does not find any JREs then the
364 next plug-in is used, and so on.</p>
367 [out] a <code>JavaInfo</code> pointer, representing the selected JRE.
368 The caller has to free it by calling <code>jfw_freeJavaInfo<code>. The
369 <code>JavaInfo</code> is for informational purposes only. It is not
370 necessary to call <code>jfw_setSelectedJRE</code> afterwards.<br/>
371 <code>ppInfo</code>can be NULL. If <code>*ppInfo</code> is not null, then it is
372 overwritten, without attempting to free <code>*ppInfo</code>.
375 JFW_E_NONE function ran successfully.<br/>
376 JFW_E_ERROR an error occurred. <br/>
377 JFW_E_NO_PLUGIN a plug-in library could not be found.<br/>
378 JFW_E_NO_JAVA_FOUND no JRE was found that meets the requirements.</br>
379 JFW_E_DIRECT_MODE the function cannot be used in this mode. </br>
380 JFW_E_CONFIGURATION mode was not properly set or their prerequisites
383 JVMFWK_DLLPUBLIC javaFrameworkError SAL_CALL
jfw_findAndSelectJRE(JavaInfo
**pInfo
);
385 /** provides information about all availabe JRE installations.
387 <p>The function determines dynamically what JREs are available. It uses
388 the plug-in libraries to provide lists of available <code>JavaInfo</code>
389 objects where each object represents a JRE (see vendorplugin.h,
390 getAllJavaInfos). It also uses a list of paths, which have been registered
391 by <code>jfw_addJRELocation</code> or <code>jfw_setJRELocations</code>.
392 It is checked if the path still contains a valid JRE and if so the respective
393 <code>JavaInfo</code> object will be appended to the array unless there is
394 already an equal object.</p>
397 [out] on returns it contains a pointer to an array of <code>JavaInfo</code>
399 The caller must free the array with <code>rtl_freeMemory</code> and each
400 element of the array must be freed with <code>jfw_freeJavaInfo</code>.
402 [out] on return contains the size of array returned in <code>parInfo</code>.
405 JFW_E_NONE function ran successfully.<br/>
406 JFW_E_INVALID_ARG at least on of the parameters was NULL<br/>
407 JFW_E_ERROR an error occurred. <br/>
408 JFW_E_NO_PLUGIN a plug-in library could not be found.<br/>
409 JFW_E_CONFIGURATION mode was not properly set or their prerequisites
412 JVMFWK_DLLPUBLIC javaFrameworkError SAL_CALL
jfw_findAllJREs(
413 JavaInfo
***parInfo
, sal_Int32
*pSize
);
415 /** determines if a path points to a Java installation.
417 <p>If the path belongs to a JRE installation then it returns the
418 respective <code>JavaInfo</code> object. The function uses the
419 <code>getJavaInfoByPath</code> function of the plug-ins to obtain the
420 <code>JavaInfo</code> object. Only if the JRE found at the specified location
421 meets the version requirements as specified in the javavendors.xml file a
422 <code>JavaInfo</code> object is returned.<br/>
424 The functions only checks if a JRE exists but does not modify any settings.
425 To make the found JRE the "selected JRE" one has
426 to call <code>jfw_setSelectedJRE</code>.</p>
429 [in] a file URL to a directory.
431 [out] the <code>JavaInfo</code> object which represents a JRE found at the
432 location specified by <code>pPath</code>
435 JFW_E_NONE function ran successfully.<br/>
436 JFW_E_INVALID_ARG at least on of the parameters was NULL<br/>
437 JFW_E_ERROR an error occurred. <br/>
438 JFW_E_CONFIGURATION mode was not properly set or their prerequisites
440 JFW_E_NO_PLUGIN a plug-in library could not be found.<br/>
441 JFW_E_NOT_RECOGNIZED neither plug-in library could detect a JRE. <br/>
442 JFW_E_FAILED_VERSION a JRE was detected but if failed the version
443 requirements as determined by the javavendors.xml
445 JVMFWK_DLLPUBLIC javaFrameworkError SAL_CALL
jfw_getJavaInfoByPath(
446 rtl_uString
*pPath
, JavaInfo
**ppInfo
);
449 /** starts a Java Virtual Machine (JVM).
451 <p>The function uses the current settings to start a JVM. The actual
452 start-up code, however, is provided by the plug-in libraries. The setting
453 of the "selected Java" contains the information as to what vendor
454 the respective JRE comes from. In the javavendors.xml there is a mapping of
455 vendor names to the respective plug-in libraries.</p>
457 The function ultimately calls <code>startJavaVirtualMachine</code> from
458 the plug-in library.</p>
460 The <code>arOptions</code>
461 argument contains start arguments which are passed in JavaVMOption structures
462 to the VM during its creation. These
463 could be things, such as language settings, proxy settings or any other
464 properties which shall be obtainable by
465 <code>java.lang.System.getProperties</code>. One can also pass options which
466 have a certain meaning to the runtime behaviour such as -ea or -X... However,
467 one must be sure that these options can be interpreted by the VM.<br/>
468 The class path cannot be set this way. The class path is internally composed by
469 the paths to archives in a certain directory, which is preconfigured in
470 the internal data store and the respective user setting (see
471 <code>jfw_setUserClassPath</code>.</p>
473 If a JRE was selected at runtime which was different from the previous
474 setting and that JRE needs a prepared environment, for example an adapted
475 <code>LD_LIBRARY_PATH</code> environment variable, then the VM will not be
476 created and JFW_E_NEED_RESTART error is returned. If a VM is already running
477 then a JFW_E_RUNNING_JVM is returned.</p>
480 [in] optional pointer to a specific JRE; must be caller-freed if not NULL
482 [in] the array containing additional start arguments or NULL.
484 [in] the size of the array <code>arOptions</code>.
486 [out] the <code>JavaVM</code> pointer.
488 [out] the <code>JNIenv</code> pointer.
491 JFW_E_NONE function ran successfully.<br/>
492 JFW_E_INVALID_ARG <code>ppVM</code>, <code>ppEnv</code> are NULL or
493 <code>arOptions</code> was NULL but <code>nSize</code> was greater 0.<br/>
494 JFW_E_ERROR an error occurred. <br/>
495 JFW_E_CONFIGURATION mode was not properly set or their prerequisites
497 JFW_E_NO_PLUGIN the plug-in library responsible for creating the VM
498 could not be found.<br/>
499 JFW_E_JAVA_DISABLED the use of Java is currently disabled. <br/>
500 JFW_E_NO_SELECT there is no JRE selected yet. <br/>
501 JFW_E_RUNNIN_JVM there is already a VM running.<br/>
502 JFW_E_INVALID_SETTINGS the javavendors.xml has been changed and no
503 JRE has been selected afterwards. <br/>
504 JFW_E_NEED_RESTART in the current process a different JRE has been selected
505 which needs a prepared environment, which has to be done before the office
506 process. Therefore the new JRE may not be used until the office was restarted.<br/>
507 JFW_E_NEED_RESTART is also returned when Java was disabled at the beginning and
508 then the user enabled it. If then the selected JRE has the requirement
509 JFW_REQUIRE_NEEDRESTART then this error is returned. </br>
510 JFW_E_VM_CREATION_FAILED the creation of the JVM failed. The creation is performed
511 by a plug-in library and not by this API.
512 JFW_E_FAILED_VERSION the "Default Mode" is active. The JRE determined by
513 <code>JAVA_HOME</code>does not meet the version requirements.
515 JVMFWK_DLLPUBLIC javaFrameworkError SAL_CALL
jfw_startVM(
516 JavaInfo
const * pInfo
, JavaVMOption
* arOptions
, sal_Int32 nSize
,
517 JavaVM
** ppVM
, JNIEnv
** ppEnv
);
519 /** determines the JRE that is to be used.
521 <p>When calling <code>jfw_startVM</code> then a VM is startet from
522 the JRE that is determined by this function.<br/>
523 It is not verified if the JRE represented by the <code>JavaInfo</code>
524 argument meets the requirements as specified by the javavendors.xml file.
525 However, usually one obtains the <code>JavaInfo</code> object from the
526 functions <code>jfw_findAllJREs</code> or <code>jfw_getJavaInfoByPath</code>,
527 which do verify the JREs and pass out only <code>JavaInfo</code> objects
528 which comply with the version requirements.</p>
530 If <code>pInfo</code> is NULL then the meaning is that no JRE will be
531 selected. <code>jfw_startVM</code> will then return
532 <code>JFW_E_NO_SELECT</code>.</p>
535 [in] pointer to <code>JavaInfo</code> structure, containing data about a
536 JRE. The caller must still free <code>pInfo</code>.
539 JFW_E_NONE function ran successfully.<br/>
540 JFW_E_ERROR An error occurred.<br/>
541 JFW_E_CONFIGURATION mode was not properly set or their prerequisites
543 JFW_E_DIRECT_MODE the function cannot be used in this mode.
545 JVMFWK_DLLPUBLIC javaFrameworkError SAL_CALL
jfw_setSelectedJRE(JavaInfo
const *pInfo
);
548 /** provides information about the JRE that is to be used.
550 <p>If no JRE is currently selected then <code>ppInfo</code> will contain
552 If the value of the element <updated> in the javavendors.xml file was
553 changed since the time when the last Java was selected then this
554 function returns <code>JFW_E_INVALID_SETTINGS</code>. This could happen during
555 a product patch. Then new version requirements may be introduced, so that
556 the currently selected JRE may not meet these requirements anymore.
558 <p>In direct mode the function returns information about a JRE that was
559 set by the bootstrap parameter UNO_JAVA_JFW_JREHOME.
562 [out] on return it contains a pointer to a <code>JavaInfo</code> object
563 that represents the currently selected JRE. When <code>*ppInfo</code> is not
564 NULL then the function overwrites the pointer. It is not attempted to free
568 JFW_E_NONE function ran successfully.<br/>
569 JFW_E_INVALIDARG <code>ppInfo</code> is a NULL.<br/>
570 JFW_E_CONFIGURATION mode was not properly set or their prerequisites
572 JFW_E_INVALID_SETTINGS the javavendors.xml has been changed and no
573 JRE has been selected afterwards. <br/>
575 JVMFWK_DLLPUBLIC javaFrameworkError SAL_CALL
jfw_getSelectedJRE(JavaInfo
**ppInfo
);
578 /** determines if Java can be used.
580 <p>If <code>bEnabled</code> is <code>sal_False</code> then a call
581 to jfw_startVM will result in an error with the errorcode
582 <code>JFW_E_JAVA_DISABLED</code></p>
585 [in] use of Java enabled/disabled.
588 JFW_E_NONE function ran successfully.<br/>
589 JFW_E_ERROR An error occurred.<br/>
590 JFW_E_CONFIGURATION mode was not properly set or their prerequisites
592 JFW_E_DIRECT_MODE the function cannot be used in this mode.
594 JVMFWK_DLLPUBLIC javaFrameworkError SAL_CALL
jfw_setEnabled(sal_Bool bEnabled
);
596 /** provides the information if Java can be used.
598 <p>That is if the user enabled or disabled the use of Java.
602 JFW_E_NONE function ran successfully.<br/>
603 JFW_E_INVALIDARG pbEnabled is NULL<br/>
604 JFW_E_ERROR An error occurred.<br/>
605 JFW_E_CONFIGURATION mode was not properly set or their prerequisites
607 JFW_E_DIRECT_MODE the function cannot be used in this mode.
609 JVMFWK_DLLPUBLIC javaFrameworkError SAL_CALL
jfw_getEnabled(sal_Bool
*pbEnabled
);
611 /** determines parameters which are passed to VM during its creation.
613 <p>The strings must be exactly as they are passed on the command line.
614 For example, one could pass<br/>
616 -Xrunjdw:transport=dt_socket,server=y,address=8000<br/>
617 in order to enable debugging support.
621 [in] contains the arguments. It can be NULL if nSize is 0.
623 [i] the size of <code>arArgs</code>
626 JFW_E_NONE function ran successfully.<br/>
627 JFW_E_INVALIDARG arArgs is NULL and nSize is not 0
628 JFW_E_ERROR An error occurred.<br/>
629 JFW_E_CONFIGURATION mode was not properly set or their prerequisites
631 JFW_E_DIRECT_MODE the function cannot be used in this mode.
633 JVMFWK_DLLPUBLIC javaFrameworkError SAL_CALL
jfw_setVMParameters(
634 rtl_uString
** arArgs
, sal_Int32 nSize
);
636 /** obtains the currently used start parameters.
638 <p>The caller needs to free the returned array with
639 <code>rtl_freeMemory</code>. The contained strings must be released with
640 <code>rtl_uString_release</code>.
644 [out] on returns contains a pointer to the array of the start arguments.
645 If *parParameters is not NULL then the value is overwritten.
647 [out] on return contains the size of array returned in
648 <code>parParameters</code>
651 JFW_E_NONE function ran successfully.<br/>
652 JFW_E_INVALIDARG parParameters or pSize are NULL<br/>
653 JFW_E_ERROR An error occurred.<br/>
654 JFW_E_CONFIGURATION mode was not properly set or their prerequisites
656 JFW_E_DIRECT_MODE the function cannot be used in this mode.
658 JVMFWK_DLLPUBLIC javaFrameworkError SAL_CALL
jfw_getVMParameters(
659 rtl_uString
*** parParameters
,
662 /** sets the user class path.
664 <p>When the VM is started then it is passed the class path. The
665 class path also contains the user class path set by this function.
666 The paths contained in <code>pCP</code> must be separated with a
667 system dependent path separator.</p>
670 [in] the user class path.
673 JFW_E_NONE function ran successfully.<br/>
674 JFW_E_INVALIDARG pCP is NULL.<br/>
675 JFW_E_ERROR An error occurred.<br/>
676 JFW_E_CONFIGURATION mode was not properly set or their prerequisites
678 JFW_E_DIRECT_MODE the function cannot be used in this mode.
680 JVMFWK_DLLPUBLIC javaFrameworkError SAL_CALL
jfw_setUserClassPath(rtl_uString
* pCP
);
681 /** provides the value of the current user class path.
683 <p>The function returns an empty string if no user class path is set.
687 [out] contains the user class path on return. If <code>*ppCP</code> was
688 not NULL then the value is overwritten. No attempt at freeing that string
692 JFW_E_NONE function ran successfully.<br/>
693 JFW_E_INVALIDARG ppCP is NULL.<br/>
694 JFW_E_ERROR An error occurred.<br/>
695 JFW_E_CONFIGURATION mode was not properly set or their prerequisites
697 JFW_E_DIRECT_MODE the function cannot be used in this mode.
699 JVMFWK_DLLPUBLIC javaFrameworkError SAL_CALL
jfw_getUserClassPath(rtl_uString
** ppCP
);
701 /** saves the location of a JRE.
703 <p>When <code>jfw_findAllJREs</code> is called then the paths added by this
704 function are evaluated. If the location still represents a
705 JRE then a <code>JavaInfo</code> object is created which is returned along
706 with all other <code>JavaInfo</code> objects by
707 <code>jfw_findAllJREs</code>. If the location
708 cannot be recognized then the location string is ignored. </p>
710 A validation if <code>sLocation</code> points to a JRE is not
711 performed. To do that one has to use <code>jfw_getJavaInfoByPath</code>.
714 Adding a path that is already stored causes no error.</p>
717 [in] file URL to a directory which contains a JRE.
720 JFW_E_NONE function ran successfully.<br/>
721 JFW_E_INVALIDARG sLocation is NULL.<br/>
722 JFW_E_ERROR An error occurred.<br/>
723 JFW_E_CONFIGURATION mode was not properly set or their prerequisites
725 JFW_E_DIRECT_MODE the function cannot be used in this mode.
726 @see jfw_setJRELocations
728 JVMFWK_DLLPUBLIC javaFrameworkError SAL_CALL
jfw_addJRELocation(rtl_uString
* sLocation
);
730 /** saves the locations of a number of JREs.
733 The function does not verify if the paths points to JRE. However,
734 it makes sure that every path is unique. That is, if the array
735 contains strings which are the same then only one is stored.</p>
737 If <code>arLocations</code> is NULL or it has the length null (nSize = 0)
738 then all previously stored paths are deleted. Otherwise,
739 the old values are overwritten.</p>
742 [in] array of paths to locations of JREs.
745 [in] the size of the array <code>arLocations</code>
748 JFW_E_NONE function ran successfully.<br/>
749 JFW_E_INVALIDARG arLocation is NULL and nSize is not null.<br/>
750 JFW_E_ERROR An error occurred.<br/>
751 JFW_E_CONFIGURATION mode was not properly set or their prerequisites
753 JFW_E_DIRECT_MODE the function cannot be used in this mode.
754 @see jfw_addJRELocations
756 JVMFWK_DLLPUBLIC javaFrameworkError SAL_CALL
jfw_setJRELocations(
757 rtl_uString
** arLocations
, sal_Int32 nSize
);
758 /** obtains an array containing paths to JRE installations.
761 It is not guaranteed that the returned paths represent
762 a valid JRE. One can use <code>jfw_getJavaInfoByPath</code> to check this.
766 [out] on return it contains the array of paths.
768 [out] on return it contains the size of the array <code>parLocations</code>.
771 JFW_E_NONE function ran successfully.<br/>
772 JFW_E_INVALIDARG parLocation is NULL or pSize is NULL.<br/>
773 JFW_E_ERROR An error occurred.<br/>
774 JFW_E_CONFIGURATION mode was not properly set or their prerequisites
776 JFW_E_DIRECT_MODE the function cannot be used in this mode.
778 JVMFWK_DLLPUBLIC javaFrameworkError SAL_CALL
jfw_getJRELocations(
779 rtl_uString
*** parLocations
, sal_Int32
* pSize
);
782 /** checks if the installation of the jre still exists.
784 This function checks if the JRE described by pInfo still
785 exists. The check must be very quick because it is called by javaldx
786 (Linux, Solaris) at start up.
789 [in] the JavaInfo object with information about the JRE.
791 [out] the parameter is set to either sal_True or sal_False. The value is
792 only valid if the function returns JFW_E_NONE.
795 JFW_E_NONE the function ran successfully.</br>
796 JFW_E_ERROR an error occurred during execution.</br>
797 JFW_E_INVALID_ARG pInfo contains invalid data</br>
798 JFW_E_NO_PLUGIN a plug-in library could not be found.<br/>
800 JVMFWK_DLLPUBLIC javaFrameworkError SAL_CALL
jfw_existJRE(const JavaInfo
*pInfo
, sal_Bool
*exist
);
803 /** locks this API so that it cannot be used by other threads.
805 <p>If a different thread called this function before then the
806 current call is blocked until the other thread has called
807 <code>jfw_unlock()</code>. The function should be called if one
808 needs an exact snapshot of the current settings. Then the settings
809 are retrieved one by one without risk that the settings may be changed
810 by a different thread. Similiary if one needs to make settings which
811 should become effective at the same time then <code>jfw_lock</code>
812 should be called. That is, <code>jfw_startVM</code> which uses the
813 settings cannot be called before all settings have be made.</p>
815 The only functions which are not effected by <code>jfw_lock</code> are
816 <code>jfw_freeJavaInfo</code> and <code>jfw_areEqualJavaInfo</code>.
818 JVMFWK_DLLPUBLIC
void SAL_CALL
jfw_lock();
820 /** unlocks this API.
822 <p>This function is called after <code>jfw_lock</code>. It allows other
823 threads to use this API concurrently.</p>
825 JVMFWK_DLLPUBLIC
void SAL_CALL
jfw_unlock();
835 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */