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 .
20 #include <sal/config.h>
21 #include <sal/log.hxx>
26 #include <rtl/bootstrap.hxx>
27 #include <rtl/ref.hxx>
28 #include <rtl/ustring.hxx>
29 #include <osl/diagnose.h>
30 #include <osl/file.hxx>
32 #include <osl/process.h>
34 #include <osl/thread.hxx>
35 #include <o3tl/string_view.hxx>
36 #include <jvmfwk/framework.hxx>
37 #include <vendorbase.hxx>
38 #include <vendorplugin.hxx>
41 #include "framework.hxx"
42 #include <fwkutil.hxx>
43 #include <elements.hxx>
44 #include <fwkbase.hxx>
48 bool g_bEnabledSwitchedOn
= false;
50 JavaVM
* g_pJavaVM
= nullptr;
52 bool areEqualJavaInfo(
53 JavaInfo
const * pInfoA
,JavaInfo
const * pInfoB
)
55 return jfw_areEqualJavaInfo(pInfoA
, pInfoB
);
60 javaFrameworkError
jfw_findAllJREs(std::vector
<std::unique_ptr
<JavaInfo
>> *pparInfo
)
62 assert(pparInfo
!= nullptr);
65 osl::MutexGuard
guard(jfw::FwkMutex());
67 jfw::VendorSettings aVendorSettings
;
68 std::vector
<std::unique_ptr
<JavaInfo
>> vecInfo
;
70 //Use all plug-in libraries to get Java installations.
71 std::vector
<std::unique_ptr
<JavaInfo
>> arInfos
;
72 std::vector
<rtl::Reference
<jfw_plugin::VendorBase
>> infos
;
73 javaPluginError plerr
= jfw_plugin_getAllJavaInfos(
79 if (plerr
!= javaPluginError::NONE
)
82 for (auto & j
: arInfos
)
83 vecInfo
.push_back(std::move(j
));
85 // direct mode disregards Java settings, so only retrieve
86 // JREs from settings when application mode is used
87 if (jfw::getMode() == jfw::JFW_MODE_APPLICATION
)
89 //get the list of paths to jre locations which have been
91 const jfw::MergedSettings settings
;
92 const std::vector
<OUString
>& vecJRELocations
=
93 settings
.getJRELocations();
94 //Check if any plugin can detect JREs at the location
95 // of the paths added by jfw_addJRELocation
96 //Check every manually added location
97 for (auto const & ii
: vecJRELocations
)
99 std::unique_ptr
<JavaInfo
> aInfo
;
100 plerr
= jfw_plugin_getJavaInfoByPath(
104 if (plerr
== javaPluginError::NoJre
)
106 if (plerr
== javaPluginError::FailedVersion
)
108 if (plerr
== javaPluginError::WrongArch
)
110 else if (plerr
!= javaPluginError::NONE
)
113 // Was this JRE already added?
115 vecInfo
.begin(), vecInfo
.end(),
116 [&aInfo
](std::unique_ptr
<JavaInfo
> const & info
) {
117 return areEqualJavaInfo(
118 info
.get(), aInfo
.get());
121 vecInfo
.push_back(std::move(aInfo
));
126 *pparInfo
= std::move(vecInfo
);
130 catch (const jfw::FrameworkException
& e
)
132 SAL_WARN( "jfw", e
.message
);
137 std::vector
<OUString
> jfw_convertUserPathList(std::u16string_view sUserPath
)
139 std::vector
<OUString
> result
;
143 size_t nextColon
= sUserPath
.find(SAL_PATHSEPARATOR
, nIdx
);
144 std::u16string_view sToken
;
145 if (nextColon
!= 0 && nextColon
!= std::u16string_view::npos
)
146 sToken
= sUserPath
.substr(nIdx
, nextColon
- nIdx
);
148 sToken
= sUserPath
.substr(nIdx
, sUserPath
.size() - nIdx
);
150 // Check if we are in bootstrap variable mode (class path starts with '$').
151 // Then the class path must be in URL format.
152 if (o3tl::starts_with(sToken
, u
"$"))
154 // Detect open bootstrap variables - they might contain colons - we need to skip those.
155 size_t nBootstrapVarStart
= sToken
.find(u
"${");
156 if (nBootstrapVarStart
!= std::u16string_view::npos
)
158 size_t nBootstrapVarEnd
= sToken
.find(u
"}", nBootstrapVarStart
);
159 if (nBootstrapVarEnd
== std::u16string_view::npos
)
161 // Current colon is part of bootstrap variable - skip it!
162 const auto nAfterColon
= (nextColon
!= std::string_view::npos
) ? (nextColon
+ 1) : 0;
163 nextColon
= sUserPath
.find(SAL_PATHSEPARATOR
, nAfterColon
);
164 if (nextColon
!= 0 && nextColon
!= std::u16string_view::npos
)
165 sToken
= sUserPath
.substr(nIdx
, nextColon
- nIdx
);
167 sToken
= sUserPath
.substr(nIdx
, sUserPath
.size() - nIdx
);
171 result
.emplace_back(sToken
);
172 if (nextColon
== std::u16string_view::npos
)
174 nIdx
= nextColon
+ 1;
179 javaFrameworkError
jfw_startVM(
180 JavaInfo
const * pInfo
, std::vector
<OUString
> const & arOptions
,
181 JavaVM
** ppVM
, JNIEnv
** ppEnv
)
183 assert(ppVM
!= nullptr);
184 javaFrameworkError errcode
= JFW_E_NONE
;
188 osl::MutexGuard
guard(jfw::FwkMutex());
190 //We keep this pointer so we can determine if a VM has already
192 if (g_pJavaVM
!= nullptr)
193 return JFW_E_RUNNING_JVM
;
195 std::vector
<OString
> vmParams
;
196 OString sUserClassPath
;
197 std::unique_ptr
<JavaInfo
> aInfo
;
198 if (pInfo
== nullptr)
200 jfw::JFW_MODE mode
= jfw::getMode();
201 if (mode
== jfw::JFW_MODE_APPLICATION
)
203 const jfw::MergedSettings settings
;
204 if (!settings
.getEnabled())
205 return JFW_E_JAVA_DISABLED
;
206 aInfo
= settings
.createJavaInfo();
207 //check if a Java has ever been selected
209 return JFW_E_NO_SELECT
;
211 //check if the javavendors.xml has changed after a Java was selected
212 OString sVendorUpdate
= jfw::getElementUpdated();
214 if (sVendorUpdate
!= settings
.getJavaInfoAttrVendorUpdate())
215 return JFW_E_INVALID_SETTINGS
;
217 //check if JAVA is disabled
218 //If Java is enabled, but it was disabled when this process was started
219 // then no preparational work, such as setting the LD_LIBRARY_PATH, was
220 //done. Therefore if a JRE needs it, it must not be started.
221 if (g_bEnabledSwitchedOn
&&
222 (aInfo
->nRequirements
& JFW_REQUIRE_NEEDRESTART
))
223 return JFW_E_NEED_RESTART
;
225 //Check if the selected Java was set in this process. If so it
226 //must not have the requirements flag JFW_REQUIRE_NEEDRESTART
227 if ((aInfo
->nRequirements
& JFW_REQUIRE_NEEDRESTART
)
228 && jfw::wasJavaSelectedInSameProcess())
229 return JFW_E_NEED_RESTART
;
231 vmParams
= settings
.getVmParametersUtf8();
232 // Expand user classpath (might contain bootstrap vars)
233 const OUString
& sUserPath(settings
.getUserClassPath());
234 std::vector paths
= jfw_convertUserPathList(sUserPath
);
235 OUString sUserPathExpanded
;
236 for (auto& path
: paths
)
238 if (!sUserPathExpanded
.isEmpty())
239 sUserPathExpanded
+= OUStringChar(SAL_PATHSEPARATOR
);
240 if (path
.startsWith("$"))
242 OUString sURL
= path
;
243 rtl::Bootstrap::expandMacros(sURL
);
244 osl::FileBase::getSystemPathFromFileURL(sURL
, path
);
246 sUserPathExpanded
+= path
;
248 sUserClassPath
= jfw::makeClassPathOption(sUserPathExpanded
);
249 } // end mode FWK_MODE_OFFICE
250 else if (mode
== jfw::JFW_MODE_DIRECT
)
252 errcode
= jfw_getSelectedJRE(&aInfo
);
253 if (errcode
!= JFW_E_NONE
)
255 //In direct mode the options are specified by bootstrap variables
256 //of the form UNO_JAVA_JFW_PARAMETER_1 .. UNO_JAVA_JFW_PARAMETER_n
257 vmParams
= jfw::BootParams::getVMParameters();
258 auto const cp
= jfw::BootParams::getClasspath();
262 "-Djava.class.path=" + cp
;
269 assert(pInfo
!= nullptr);
272 // Alternative JREs (AdoptOpenJDK, Azul Zulu) are missing the bin/ folder in
273 // java.library.path. Somehow setting java.library.path accordingly doesn't work,
274 // but the PATH gets picked up, so add it there.
275 // Without this hack, some features don't work in alternative JREs.
277 osl_getEnvironment(OUString("PATH").pData
, &sPATH
.pData
);
278 OUString sJRELocation
;
279 osl::FileBase::getSystemPathFromFileURL(pInfo
->sLocation
+ "/bin", sJRELocation
);
281 sPATH
= sJRELocation
;
283 sPATH
= sJRELocation
+ OUStringChar(SAL_PATHSEPARATOR
) + sPATH
;
284 osl_setEnvironment(OUString("PATH").pData
, sPATH
.pData
);
287 // create JavaVMOptions array that is passed to the plugin
288 // it contains the classpath and all options set in the
290 std::unique_ptr
<JavaVMOption
[]> sarJOptions(
292 arOptions
.size() + (sUserClassPath
.isEmpty() ? 2 : 3) + vmParams
.size()]);
293 JavaVMOption
* arOpt
= sarJOptions
.get();
297 //The first argument is the classpath
299 if (!sUserClassPath
.isEmpty()) {
300 arOpt
[index
].optionString
= const_cast<char*>(sUserClassPath
.getStr());
301 arOpt
[index
].extraInfo
= nullptr;
304 // Set a flag that this JVM has been created via the JNI Invocation API
305 // (used, for example, by UNO remote bridges to share a common thread pool
306 // factory among Java and native bridge implementations):
307 arOpt
[index
].optionString
= const_cast<char *>("-Dorg.openoffice.native=");
308 arOpt
[index
].extraInfo
= nullptr;
311 // Don't intercept SIGTERM
312 arOpt
[index
].optionString
= const_cast<char *>("-Xrs");
313 arOpt
[index
].extraInfo
= nullptr;
316 //add the options set by options dialog
317 for (auto const & vmParam
: vmParams
)
319 arOpt
[index
].optionString
= const_cast<char*>(vmParam
.getStr());
320 arOpt
[index
].extraInfo
= nullptr;
323 //add all options of the arOptions argument
324 std::vector
<OString
> convertedOptions
;
325 for (auto const & ii
: arOptions
)
327 OString conv
= OUStringToOString(ii
, osl_getThreadTextEncoding());
328 convertedOptions
.push_back(conv
);
329 // keep conv.getStr() alive until after the call to
330 // jfw_plugin_startJavaVirtualMachine below
331 arOpt
[index
].optionString
= const_cast<char *>(conv
.getStr());
332 arOpt
[index
].extraInfo
= nullptr;
337 JavaVM
*pVm
= nullptr;
338 SAL_INFO("jfw", "Starting Java");
339 javaPluginError plerr
= jfw_plugin_startJavaVirtualMachine(pInfo
, arOpt
, index
, & pVm
, ppEnv
);
340 if (plerr
== javaPluginError::VmCreationFailed
)
342 errcode
= JFW_E_VM_CREATION_FAILED
;
344 else if (plerr
!= javaPluginError::NONE
)
346 errcode
= JFW_E_ERROR
;
354 catch (const jfw::FrameworkException
& e
)
356 errcode
= e
.errorCode
;
357 SAL_WARN( "jfw", e
.message
);
363 /** We do not use here jfw_findAllJREs and then check if a JavaInfo
364 meets the requirements, because that means using all plug-ins, which
365 may take quite a while. The implementation first inspects JAVA_HOME and
366 PATH environment variables. If no suitable JavaInfo is found there, it
367 inspects all JavaInfos found by the jfw_plugin_get* functions.
369 javaFrameworkError
jfw_findAndSelectJRE(std::unique_ptr
<JavaInfo
> *pInfo
)
371 javaFrameworkError errcode
= JFW_E_NONE
;
374 osl::MutexGuard
guard(jfw::FwkMutex());
375 if (jfw::getMode() == jfw::JFW_MODE_DIRECT
)
376 return JFW_E_DIRECT_MODE
;
377 std::unique_ptr
<JavaInfo
> aCurrentInfo
;
380 // 'bInfoFound' indicates whether a Java installation has been found
381 bool bInfoFound
= false;
383 // get list of vendors for Java installations
384 jfw::VendorSettings aVendorSettings
;
386 std::vector
<rtl::Reference
<jfw_plugin::VendorBase
>> infos
;
388 // first inspect Java installation that the JAVA_HOME
389 // environment variable points to (if it is set)
390 if (jfw_plugin_getJavaInfoFromJavaHome(
391 aVendorSettings
, &aCurrentInfo
, infos
)
392 == javaPluginError::NONE
)
397 // if no Java installation was detected by using JAVA_HOME,
398 // query PATH for Java installations
401 std::vector
<std::unique_ptr
<JavaInfo
>> vecJavaInfosFromPath
;
402 if (jfw_plugin_getJavaInfosFromPath(
403 aVendorSettings
, vecJavaInfosFromPath
, infos
)
404 == javaPluginError::NONE
)
406 assert(!vecJavaInfosFromPath
.empty());
407 aCurrentInfo
= std::move(vecJavaInfosFromPath
[0]);
413 // if no suitable Java installation has been found yet:
414 // first use jfw_plugin_getAllJavaInfos to find a suitable Java installation,
415 // then try paths that have been added manually
418 //get all installations
419 std::vector
<std::unique_ptr
<JavaInfo
>> arInfos
;
420 javaPluginError plerr
= jfw_plugin_getAllJavaInfos(
426 if (plerr
== javaPluginError::NONE
&& !arInfos
.empty())
428 aCurrentInfo
= std::move(arInfos
[0]);
432 {//The plug-ins did not find a suitable Java. Now try the paths which have been
434 //get the list of paths to jre locations which have been added manually
435 const jfw::MergedSettings settings
;
436 //node.loadFromSettings();
437 const std::vector
<OUString
> & vecJRELocations
=
438 settings
.getJRELocations();
439 //use all plug-ins to determine the JavaInfo objects
440 for (auto const & JRELocation
: vecJRELocations
)
442 std::unique_ptr
<JavaInfo
> aInfo
;
443 javaPluginError err
= jfw_plugin_getJavaInfoByPath(
447 if (err
== javaPluginError::NoJre
)
449 if (err
== javaPluginError::FailedVersion
)
451 else if (err
!=javaPluginError::NONE
)
456 aCurrentInfo
= std::move(aInfo
);
459 }//end iterate over paths
464 jfw::NodeJava
javaNode(jfw::NodeJava::USER
);
465 javaNode
.setJavaInfo(aCurrentInfo
.get(),true);
467 //remember that this JRE was selected in this process
468 jfw::setJavaSelected();
472 *pInfo
= std::move(aCurrentInfo
);
477 errcode
= JFW_E_NO_JAVA_FOUND
;
480 catch (const jfw::FrameworkException
& e
)
482 errcode
= e
.errorCode
;
483 SAL_WARN( "jfw", e
.message
);
489 bool jfw_areEqualJavaInfo(JavaInfo
const * pInfoA
,JavaInfo
const * pInfoB
)
491 if (pInfoA
== pInfoB
)
493 if (pInfoA
== nullptr || pInfoB
== nullptr)
495 if (pInfoA
->sVendor
== pInfoB
->sVendor
496 && pInfoA
->sLocation
== pInfoB
->sLocation
497 && pInfoA
->sVersion
== pInfoB
->sVersion
498 && pInfoA
->nRequirements
== pInfoB
->nRequirements
499 && pInfoA
->arVendorData
== pInfoB
->arVendorData
)
506 javaFrameworkError
jfw_getSelectedJRE(std::unique_ptr
<JavaInfo
> *ppInfo
)
508 assert(ppInfo
!= nullptr);
509 javaFrameworkError errcode
= JFW_E_NONE
;
512 osl::MutexGuard
guard(jfw::FwkMutex());
514 if (jfw::getMode() == jfw::JFW_MODE_DIRECT
)
516 if ((errcode
= jfw_getJavaInfoByPath(
517 jfw::BootParams::getJREHome(), ppInfo
))
519 throw jfw::FrameworkException(
521 "[Java framework] The JRE specified by the bootstrap "
522 "variable UNO_JAVA_JFW_JREHOME or UNO_JAVA_JFW_ENV_JREHOME "
523 " could not be recognized. Check the values and make sure that you "
524 "use a plug-in library that can recognize that JRE."_ostr
);
529 const jfw::MergedSettings settings
;
530 *ppInfo
= settings
.createJavaInfo();
535 //If the javavendors.xml has changed, then the current selected
536 //Java is not valid anymore
537 // /java/javaInfo/@vendorUpdate != javaSelection/updated (javavendors.xml)
538 OString sUpdated
= jfw::getElementUpdated();
540 if (sUpdated
!= settings
.getJavaInfoAttrVendorUpdate())
543 return JFW_E_INVALID_SETTINGS
;
546 catch (const jfw::FrameworkException
& e
)
548 errcode
= e
.errorCode
;
549 SAL_WARN( "jfw", e
.message
);
554 bool jfw_isVMRunning()
556 osl::MutexGuard
guard(jfw::FwkMutex());
557 return g_pJavaVM
!= nullptr;
560 javaFrameworkError
jfw_getJavaInfoByPath(OUString
const & pPath
, std::unique_ptr
<JavaInfo
> *ppInfo
)
562 assert(ppInfo
!= nullptr);
563 javaFrameworkError errcode
= JFW_E_NONE
;
566 osl::MutexGuard
guard(jfw::FwkMutex());
568 jfw::VendorSettings aVendorSettings
;
570 //ask all plugins if this is a JRE.
571 //If so check if it meets the version requirements.
572 //Only if it does return a JavaInfo
573 javaPluginError plerr
= jfw_plugin_getJavaInfoByPath(
578 if(plerr
== javaPluginError::FailedVersion
)
579 {//found JRE but it has the wrong version
581 errcode
= JFW_E_FAILED_VERSION
;
583 OSL_ASSERT(plerr
== javaPluginError::NONE
|| plerr
== javaPluginError::NoJre
);
584 if (!*ppInfo
&& errcode
!= JFW_E_FAILED_VERSION
)
585 errcode
= JFW_E_NOT_RECOGNIZED
;
587 catch (const jfw::FrameworkException
& e
)
589 errcode
= e
.errorCode
;
590 SAL_WARN( "jfw", e
.message
);
597 javaFrameworkError
jfw_setSelectedJRE(JavaInfo
const *pInfo
)
599 javaFrameworkError errcode
= JFW_E_NONE
;
602 osl::MutexGuard
guard(jfw::FwkMutex());
603 if (jfw::getMode() == jfw::JFW_MODE_DIRECT
)
604 return JFW_E_DIRECT_MODE
;
605 //check if pInfo is the selected JRE
606 std::unique_ptr
<JavaInfo
> currentInfo
;
607 errcode
= jfw_getSelectedJRE( & currentInfo
);
608 if (errcode
!= JFW_E_NONE
&& errcode
!= JFW_E_INVALID_SETTINGS
)
611 if (!jfw_areEqualJavaInfo(currentInfo
.get(), pInfo
))
613 jfw::NodeJava
node(jfw::NodeJava::USER
);
614 node
.setJavaInfo(pInfo
, false);
616 //remember that the JRE was selected in this process
617 jfw::setJavaSelected();
620 catch (const jfw::FrameworkException
& e
)
622 errcode
= e
.errorCode
;
623 SAL_WARN( "jfw", e
.message
);
627 javaFrameworkError
jfw_setEnabled(bool bEnabled
)
629 javaFrameworkError errcode
= JFW_E_NONE
;
632 osl::MutexGuard
guard(jfw::FwkMutex());
633 if (jfw::getMode() == jfw::JFW_MODE_DIRECT
)
634 return JFW_E_DIRECT_MODE
;
636 if (!g_bEnabledSwitchedOn
&& bEnabled
)
638 //When the process started then Enabled was false.
639 //This is first time enabled is set to true.
640 //That means, no preparational work has been done, such as setting the
641 //LD_LIBRARY_PATH, etc.
643 //check if Enabled is false;
644 const jfw::MergedSettings settings
;
645 if (!settings
.getEnabled())
646 g_bEnabledSwitchedOn
= true;
648 jfw::NodeJava
node(jfw::NodeJava::USER
);
649 node
.setEnabled(bEnabled
);
652 catch (const jfw::FrameworkException
& e
)
654 errcode
= e
.errorCode
;
655 SAL_WARN( "jfw", e
.message
);
660 javaFrameworkError
jfw_getEnabled(bool *pbEnabled
)
662 assert(pbEnabled
!= nullptr);
663 javaFrameworkError errcode
= JFW_E_NONE
;
666 if (jfw::getMode() == jfw::JFW_MODE_DIRECT
)
667 return JFW_E_DIRECT_MODE
;
668 osl::MutexGuard
guard(jfw::FwkMutex());
669 jfw::MergedSettings settings
;
670 *pbEnabled
= settings
.getEnabled();
672 catch (const jfw::FrameworkException
& e
)
674 errcode
= e
.errorCode
;
675 SAL_WARN( "jfw", e
.message
);
681 javaFrameworkError
jfw_setVMParameters(std::vector
<OUString
> const & arOptions
)
683 javaFrameworkError errcode
= JFW_E_NONE
;
686 osl::MutexGuard
guard(jfw::FwkMutex());
687 if (jfw::getMode() == jfw::JFW_MODE_DIRECT
)
688 return JFW_E_DIRECT_MODE
;
689 jfw::NodeJava
node(jfw::NodeJava::USER
);
690 node
.setVmParameters(arOptions
);
693 catch (const jfw::FrameworkException
& e
)
695 errcode
= e
.errorCode
;
696 SAL_WARN( "jfw", e
.message
);
702 javaFrameworkError
jfw_getVMParameters(std::vector
<OUString
> * parOptions
)
704 javaFrameworkError errcode
= JFW_E_NONE
;
707 osl::MutexGuard
guard(jfw::FwkMutex());
708 if (jfw::getMode() == jfw::JFW_MODE_DIRECT
)
709 return JFW_E_DIRECT_MODE
;
711 const jfw::MergedSettings settings
;
712 settings
.getVmParametersArray(parOptions
);
714 catch (const jfw::FrameworkException
& e
)
716 errcode
= e
.errorCode
;
717 SAL_WARN( "jfw", e
.message
);
722 javaFrameworkError
jfw_setUserClassPath(OUString
const & pCp
)
724 javaFrameworkError errcode
= JFW_E_NONE
;
727 osl::MutexGuard
guard(jfw::FwkMutex());
728 if (jfw::getMode() == jfw::JFW_MODE_DIRECT
)
729 return JFW_E_DIRECT_MODE
;
730 jfw::NodeJava
node(jfw::NodeJava::USER
);
731 node
.setUserClassPath(pCp
);
734 catch (const jfw::FrameworkException
& e
)
736 errcode
= e
.errorCode
;
737 SAL_WARN( "jfw", e
.message
);
742 javaFrameworkError
jfw_getUserClassPath(OUString
* ppCP
)
744 assert(ppCP
!= nullptr);
745 javaFrameworkError errcode
= JFW_E_NONE
;
748 osl::MutexGuard
guard(jfw::FwkMutex());
749 if (jfw::getMode() == jfw::JFW_MODE_DIRECT
)
750 return JFW_E_DIRECT_MODE
;
751 const jfw::MergedSettings settings
;
752 *ppCP
= settings
.getUserClassPath();
754 catch (const jfw::FrameworkException
& e
)
756 errcode
= e
.errorCode
;
757 SAL_WARN( "jfw", e
.message
);
762 javaFrameworkError
jfw_addJRELocation(OUString
const & sLocation
)
764 javaFrameworkError errcode
= JFW_E_NONE
;
767 osl::MutexGuard
guard(jfw::FwkMutex());
768 if (jfw::getMode() == jfw::JFW_MODE_DIRECT
)
769 return JFW_E_DIRECT_MODE
;
770 jfw::NodeJava
node(jfw::NodeJava::USER
);
772 node
.addJRELocation(sLocation
);
775 catch (const jfw::FrameworkException
& e
)
777 errcode
= e
.errorCode
;
778 SAL_WARN( "jfw", e
.message
);
785 javaFrameworkError
jfw_existJRE(const JavaInfo
*pInfo
, bool *exist
)
787 javaPluginError plerr
= jfw_plugin_existJRE(pInfo
, exist
);
789 javaFrameworkError ret
= JFW_E_NONE
;
792 case javaPluginError::NONE
:
795 case javaPluginError::Error
:
806 jfw::FwkMutex().acquire();
811 jfw::FwkMutex().release();
814 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */