1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
29 #include "rtl/ustring.hxx"
30 #include "rtl/ustrbuf.hxx"
31 #include "rtl/uri.hxx"
32 #include "osl/thread.hxx"
33 #include "osl/process.h"
34 #include "libxml/xpathInternals.h"
35 #include "osl/file.hxx"
36 #include "osl/module.hxx"
37 #include "framework.hxx"
38 #include "fwkutil.hxx"
39 #include "elements.hxx"
40 #include "fwkbase.hxx"
44 using ::rtl::OUString
;
45 using ::rtl::OUStringBuffer
;
47 using ::rtl::OUStringToOString
;
48 using ::rtl::OStringToOUString
;
49 #define JAVASETTINGS "javasettings"
50 #define JAVASETTINGS_XML "javasettings.xml"
51 #define VENDORSETTINGS "javavendors.xml"
53 #define UNO_JAVA_JFW_PARAMETER "UNO_JAVA_JFW_PARAMETER_"
54 #define UNO_JAVA_JFW_JREHOME "UNO_JAVA_JFW_JREHOME"
55 #define UNO_JAVA_JFW_ENV_JREHOME "UNO_JAVA_JFW_ENV_JREHOME"
56 #define UNO_JAVA_JFW_CLASSPATH "UNO_JAVA_JFW_CLASSPATH"
57 #define UNO_JAVA_JFW_ENV_CLASSPATH "UNO_JAVA_JFW_ENV_CLASSPATH"
58 #define UNO_JAVA_JFW_CLASSPATH_URLS "UNO_JAVA_JFW_CLASSPATH_URLS"
59 #define UNO_JAVA_JFW_PARAMETERS "UNO_JAVA_JFW_PARAMETERS"
60 #define UNO_JAVA_JFW_VENDOR_SETTINGS "UNO_JAVA_JFW_VENDOR_SETTINGS"
61 #define UNO_JAVA_JFW_USER_DATA "UNO_JAVA_JFW_USER_DATA"
62 #define UNO_JAVA_JFW_SHARED_DATA "UNO_JAVA_JFW_SHARED_DATA"
66 bool g_bJavaSet
= false;
70 rtl::OString
getVendorSettingsPath(rtl::OUString
const & sURL
)
73 return rtl::OString();
74 rtl::OUString sSystemPathSettings
;
75 if (osl_getSystemPathFromFileURL(sURL
.pData
,
76 & sSystemPathSettings
.pData
) != osl_File_E_None
)
77 throw FrameworkException(
79 rtl::OString("[Java framework] Error in function "
80 "getVendorSettingsPath (fwkbase.cxx) "));
81 rtl::OString osSystemPathSettings
=
82 rtl::OUStringToOString(sSystemPathSettings
,osl_getThreadTextEncoding());
83 return osSystemPathSettings
;
86 rtl::OUString
getParam(const char * name
)
89 if (Bootstrap::get()->getFrom(rtl::OUString::createFromAscii(name
), retVal
))
91 #if OSL_DEBUG_LEVEL >=2
92 rtl::OString sValue
= rtl::OUStringToOString(retVal
, osl_getThreadTextEncoding());
93 fprintf(stderr
,"[Java framework] Using bootstrap parameter %s = %s.\n",
94 name
, sValue
.getStr());
100 rtl::OUString
getParamFirstUrl(const char * name
)
102 // Some parameters can consist of multiple URLs (separated by space
103 // characters, although trim() harmlessly also removes other white-space),
104 // of which only the first is used:
106 return getParam(name
).trim().getToken(0, ' ', i
);
112 VendorSettings::VendorSettings():
113 m_xmlDocVendorSettingsFileUrl(BootParams::getVendorSettings())
115 OString
sMsgExc("[Java framework] Error in constructor "
116 "VendorSettings::VendorSettings() (fwkbase.cxx)");
117 //Prepare the xml document and context
118 OString sSettingsPath
= getVendorSettingsPath(m_xmlDocVendorSettingsFileUrl
);
119 if (sSettingsPath
.isEmpty())
121 OString
sMsg("[Java framework] A vendor settings file was not specified."
122 "Check the bootstrap parameter " UNO_JAVA_JFW_VENDOR_SETTINGS
".");
123 OSL_FAIL(sMsg
.getStr());
124 throw FrameworkException(JFW_E_CONFIGURATION
, sMsg
);
126 if (!sSettingsPath
.isEmpty())
128 m_xmlDocVendorSettings
= xmlParseFile(sSettingsPath
.getStr());
129 if (m_xmlDocVendorSettings
== NULL
)
130 throw FrameworkException(
132 OString("[Java framework] Error while parsing file: ")
133 + sSettingsPath
+ OString("."));
135 m_xmlPathContextVendorSettings
= xmlXPathNewContext(m_xmlDocVendorSettings
);
136 int res
= xmlXPathRegisterNs(
137 m_xmlPathContextVendorSettings
, (xmlChar
*) "jf",
138 (xmlChar
*) NS_JAVA_FRAMEWORK
);
140 throw FrameworkException(JFW_E_ERROR
, sMsgExc
);
144 std::vector
<PluginLibrary
> VendorSettings::getPluginData()
146 OString
sExcMsg("[Java framework] Error in function VendorSettings::getVendorPluginURLs "
148 std::vector
<PluginLibrary
> vecPlugins
;
149 CXPathObjectPtr
result(xmlXPathEvalExpression(
150 (xmlChar
*)"/jf:javaSelection/jf:plugins/jf:library",
151 m_xmlPathContextVendorSettings
));
152 if (xmlXPathNodeSetIsEmpty(result
->nodesetval
))
153 throw FrameworkException(JFW_E_ERROR
, sExcMsg
);
155 //get the values of the library elements + vendor attribute
156 xmlNode
* cur
= result
->nodesetval
->nodeTab
[0];
160 //between library elements are also text elements
161 if (cur
->type
== XML_ELEMENT_NODE
)
163 CXmlCharPtr
sAttrVendor(xmlGetProp(cur
, (xmlChar
*) "vendor"));
164 CXmlCharPtr
sTextLibrary(
165 xmlNodeListGetString(m_xmlDocVendorSettings
,
166 cur
->xmlChildrenNode
, 1));
167 PluginLibrary plugin
;
168 OString
osVendor((sal_Char
*)(xmlChar
*) sAttrVendor
);
169 plugin
.sVendor
= OStringToOUString(osVendor
, RTL_TEXTENCODING_UTF8
);
171 //create the file URL to the library
172 OUString sUrl
= findPlugin(
173 m_xmlDocVendorSettingsFileUrl
, sTextLibrary
);
176 OString sPlugin
= OUStringToOString(
177 sTextLibrary
, osl_getThreadTextEncoding());
178 throw FrameworkException(
180 "[Java framework] The file: " + sPlugin
+ " does not exist.");
184 vecPlugins
.push_back(plugin
);
191 VersionInfo
VendorSettings::getVersionInformation(const rtl::OUString
& sVendor
)
193 OSL_ASSERT(!sVendor
.isEmpty());
194 VersionInfo aVersionInfo
;
195 OString osVendor
= OUStringToOString(sVendor
, RTL_TEXTENCODING_UTF8
);
197 OString sExpresion
= OString(
198 "/jf:javaSelection/jf:vendorInfos/jf:vendor[@name=\"") +
199 osVendor
+ OString("\"]/jf:minVersion");
201 CXPathObjectPtr xPathObjectMin
;
203 xmlXPathEvalExpression((xmlChar
*) sExpresion
.getStr(),
204 m_xmlPathContextVendorSettings
);
205 if (xmlXPathNodeSetIsEmpty(xPathObjectMin
->nodesetval
))
207 aVersionInfo
.sMinVersion
= OUString();
211 CXmlCharPtr sVersion
;
212 sVersion
= xmlNodeListGetString(
213 m_xmlDocVendorSettings
,
214 xPathObjectMin
->nodesetval
->nodeTab
[0]->xmlChildrenNode
, 1);
215 OString
osVersion((sal_Char
*)(xmlChar
*) sVersion
);
216 aVersionInfo
.sMinVersion
= OStringToOUString(
217 osVersion
, RTL_TEXTENCODING_UTF8
);
221 sExpresion
= OString("/jf:javaSelection/jf:vendorInfos/jf:vendor[@name=\"") +
222 osVendor
+ OString("\"]/jf:maxVersion");
223 CXPathObjectPtr xPathObjectMax
;
224 xPathObjectMax
= xmlXPathEvalExpression(
225 (xmlChar
*) sExpresion
.getStr(),
226 m_xmlPathContextVendorSettings
);
227 if (xmlXPathNodeSetIsEmpty(xPathObjectMax
->nodesetval
))
229 aVersionInfo
.sMaxVersion
= OUString();
233 CXmlCharPtr sVersion
;
234 sVersion
= xmlNodeListGetString(
235 m_xmlDocVendorSettings
,
236 xPathObjectMax
->nodesetval
->nodeTab
[0]->xmlChildrenNode
, 1);
237 OString
osVersion((sal_Char
*) (xmlChar
*) sVersion
);
238 aVersionInfo
.sMaxVersion
= OStringToOUString(
239 osVersion
, RTL_TEXTENCODING_UTF8
);
242 //Get excludeVersions
243 sExpresion
= OString("/jf:javaSelection/jf:vendorInfos/jf:vendor[@name=\"") +
244 osVendor
+ OString("\"]/jf:excludeVersions/jf:version");
245 CXPathObjectPtr xPathObjectVersions
;
246 xPathObjectVersions
=
247 xmlXPathEvalExpression((xmlChar
*) sExpresion
.getStr(),
248 m_xmlPathContextVendorSettings
);
249 if (!xmlXPathNodeSetIsEmpty(xPathObjectVersions
->nodesetval
))
251 xmlNode
* cur
= xPathObjectVersions
->nodesetval
->nodeTab
[0];
254 if (cur
->type
== XML_ELEMENT_NODE
)
256 if (xmlStrcmp(cur
->name
, (xmlChar
*) "version") == 0)
258 CXmlCharPtr sVersion
;
259 sVersion
= xmlNodeListGetString(
260 m_xmlDocVendorSettings
, cur
->xmlChildrenNode
, 1);
261 OString
osVersion((sal_Char
*)(xmlChar
*) sVersion
);
262 OUString usVersion
= OStringToOUString(
263 osVersion
, RTL_TEXTENCODING_UTF8
);
264 aVersionInfo
.addExcludeVersion(usVersion
);
273 std::vector
<OUString
> VendorSettings::getSupportedVendors()
275 std::vector
<rtl::OUString
> vecVendors
;
276 //get the nodeset for the library elements
277 jfw::CXPathObjectPtr result
;
278 result
= xmlXPathEvalExpression(
279 (xmlChar
*)"/jf:javaSelection/jf:plugins/jf:library",
280 m_xmlPathContextVendorSettings
);
281 if (xmlXPathNodeSetIsEmpty(result
->nodesetval
))
282 throw FrameworkException(
284 rtl::OString("[Java framework] Error in function getSupportedVendors (fwkbase.cxx)."));
286 //get the values of the library elements + vendor attribute
287 xmlNode
* cur
= result
->nodesetval
->nodeTab
[0];
290 //between library elements are also text elements
291 if (cur
->type
== XML_ELEMENT_NODE
)
293 jfw::CXmlCharPtr
sAttrVendor(xmlGetProp(cur
, (xmlChar
*) "vendor"));
294 vecVendors
.push_back(sAttrVendor
);
301 OUString
VendorSettings::getPluginLibrary(const OUString
& sVendor
)
303 OSL_ASSERT(!sVendor
.isEmpty());
305 OString
sExcMsg("[Java framework] Error in function getPluginLibrary (fwkbase.cxx).");
306 OString sVendorsPath
= getVendorSettingsPath(m_xmlDocVendorSettingsFileUrl
);
307 OUStringBuffer
usBuffer(256);
308 usBuffer
.appendAscii("/jf:javaSelection/jf:plugins/jf:library[@vendor=\"");
309 usBuffer
.append(sVendor
);
310 usBuffer
.appendAscii("\"]/text()");
311 OUString ouExpr
= usBuffer
.makeStringAndClear();
312 OString sExpression
=
313 OUStringToOString(ouExpr
, osl_getThreadTextEncoding());
314 CXPathObjectPtr pathObjVendor
;
315 pathObjVendor
= xmlXPathEvalExpression(
316 (xmlChar
*) sExpression
.getStr(), m_xmlPathContextVendorSettings
);
317 if (xmlXPathNodeSetIsEmpty(pathObjVendor
->nodesetval
))
318 throw FrameworkException(JFW_E_ERROR
, sExcMsg
);
320 CXmlCharPtr xmlCharPlugin
;
322 xmlNodeListGetString(
323 m_xmlDocVendorSettings
,pathObjVendor
->nodesetval
->nodeTab
[0], 1);
325 //make an absolute file url from the relative plugin URL
326 OUString sUrl
= findPlugin(m_xmlDocVendorSettingsFileUrl
, xmlCharPlugin
);
329 OString sPlugin
= OUStringToOString(
330 xmlCharPlugin
, osl_getThreadTextEncoding());
331 throw FrameworkException(
333 "[Java framework] The file: " + sPlugin
+ " does not exist.");
338 ::std::vector
<OString
> BootParams::getVMParameters()
340 ::std::vector
<OString
> vecParams
;
342 for (sal_Int32 i
= 1; ; i
++)
345 OUString(RTL_CONSTASCII_USTRINGPARAM(UNO_JAVA_JFW_PARAMETER
)) +
346 OUString::valueOf(i
);
348 if (Bootstrap::get()->getFrom(sName
, sValue
) == sal_True
)
351 OUStringToOString(sValue
, osl_getThreadTextEncoding());
352 vecParams
.push_back(sParam
);
353 #if OSL_DEBUG_LEVEL >=2
354 rtl::OString sParamName
= rtl::OUStringToOString(sName
, osl_getThreadTextEncoding());
355 fprintf(stderr
,"[Java framework] Using bootstrap parameter %s"
356 " = %s.\n", sParamName
.getStr(), sParam
.getStr());
365 rtl::OUString
BootParams::getUserData()
367 return getParamFirstUrl(UNO_JAVA_JFW_USER_DATA
);
370 rtl::OUString
BootParams::getSharedData()
372 return getParamFirstUrl(UNO_JAVA_JFW_SHARED_DATA
);
375 rtl::OString
BootParams::getClasspath()
377 rtl::OString sClassPath
;
379 char szSep
[] = {SAL_PATHSEPARATOR
,0};
380 if (Bootstrap::get()->getFrom(
381 rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(UNO_JAVA_JFW_CLASSPATH
)),
384 sClassPath
= rtl::OUStringToOString(
385 sCP
, osl_getThreadTextEncoding());
386 #if OSL_DEBUG_LEVEL >=2
387 fprintf(stderr
,"[Java framework] Using bootstrap parameter "
388 UNO_JAVA_JFW_CLASSPATH
" = %s.\n", sClassPath
.getStr());
392 rtl::OUString sEnvCP
;
393 if (Bootstrap::get()->getFrom(
394 rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(UNO_JAVA_JFW_ENV_CLASSPATH
)),
397 char * pCp
= getenv("CLASSPATH");
400 sClassPath
+= rtl::OString(szSep
) + rtl::OString(pCp
);
402 #if OSL_DEBUG_LEVEL >=2
403 fprintf(stderr
,"[Java framework] Using bootstrap parameter "
404 UNO_JAVA_JFW_ENV_CLASSPATH
" and class path is:\n %s.\n", pCp
? pCp
: "");
411 rtl::OUString
BootParams::getVendorSettings()
413 rtl::OUString sVendor
;
415 RTL_CONSTASCII_USTRINGPARAM(UNO_JAVA_JFW_VENDOR_SETTINGS
));
416 if (Bootstrap::get()->getFrom(sName
,sVendor
) == sal_True
)
418 //check the value of the bootstrap variable
419 jfw::FileStatus s
= checkFileURL(sVendor
);
422 //This bootstrap parameter can contain a relative URL
423 rtl::OUString sAbsoluteUrl
;
424 rtl::OUString sBaseDir
= getLibraryLocation();
425 if (File::getAbsoluteFileURL(sBaseDir
, sVendor
, sAbsoluteUrl
)
427 throw FrameworkException(
429 rtl::OString("[Java framework] Invalid value for bootstrap variable: "
430 UNO_JAVA_JFW_VENDOR_SETTINGS
));
431 sVendor
= sAbsoluteUrl
;
432 s
= checkFileURL(sVendor
);
433 if (s
== jfw::FILE_INVALID
|| s
== jfw::FILE_DOES_NOT_EXIST
)
435 throw FrameworkException(
437 rtl::OString("[Java framework] Invalid value for bootstrap variable: "
438 UNO_JAVA_JFW_VENDOR_SETTINGS
));
441 #if OSL_DEBUG_LEVEL >=2
442 rtl::OString sValue
= rtl::OUStringToOString(sVendor
, osl_getThreadTextEncoding());
443 fprintf(stderr
,"[Java framework] Using bootstrap parameter "
444 UNO_JAVA_JFW_VENDOR_SETTINGS
" = %s.\n", sValue
.getStr());
450 rtl::OUString
BootParams::getJREHome()
453 rtl::OUString sEnvJRE
;
454 sal_Bool bJRE
= Bootstrap::get()->getFrom(
455 rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(UNO_JAVA_JFW_JREHOME
)) ,sJRE
);
456 sal_Bool bEnvJRE
= Bootstrap::get()->getFrom(
457 rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(UNO_JAVA_JFW_ENV_JREHOME
)) ,sEnvJRE
);
459 if (bJRE
== sal_True
&& bEnvJRE
== sal_True
)
461 throw FrameworkException(
463 rtl::OString("[Java framework] Both bootstrap parameter "
464 UNO_JAVA_JFW_JREHOME
" and "
465 UNO_JAVA_JFW_ENV_JREHOME
" are set. However only one of them can be set."
466 "Check bootstrap parameters: environment variables, command line "
467 "arguments, rc/ini files for executable and java framework library."));
469 else if (bEnvJRE
== sal_True
)
471 const char * pJRE
= getenv("JAVA_HOME");
474 throw FrameworkException(
476 rtl::OString("[Java framework] Both bootstrap parameter "
477 UNO_JAVA_JFW_ENV_JREHOME
" is set, but the environment variable "
478 "JAVA_HOME is not set."));
480 rtl::OString
osJRE(pJRE
);
481 rtl::OUString usJRE
= rtl::OStringToOUString(osJRE
, osl_getThreadTextEncoding());
482 if (File::getFileURLFromSystemPath(usJRE
, sJRE
) != File::E_None
)
483 throw FrameworkException(
485 rtl::OString("[Java framework] Error in function BootParams::getJREHome() "
487 #if OSL_DEBUG_LEVEL >=2
488 fprintf(stderr
,"[Java framework] Using bootstrap parameter "
489 UNO_JAVA_JFW_ENV_JREHOME
" with JAVA_HOME = %s.\n", pJRE
);
492 else if (getMode() == JFW_MODE_DIRECT
493 && bEnvJRE
== sal_False
494 && bJRE
== sal_False
)
496 throw FrameworkException(
498 rtl::OString("[Java framework] The bootstrap parameter "
499 UNO_JAVA_JFW_ENV_JREHOME
" or " UNO_JAVA_JFW_JREHOME
500 " must be set in direct mode."));
503 #if OSL_DEBUG_LEVEL >=2
504 if (bJRE
== sal_True
)
506 rtl::OString sValue
= rtl::OUStringToOString(sJRE
, osl_getThreadTextEncoding());
507 fprintf(stderr
,"[Java framework] Using bootstrap parameter "
508 UNO_JAVA_JFW_JREHOME
" = %s.\n", sValue
.getStr());
514 rtl::OUString
BootParams::getClasspathUrls()
516 rtl::OUString sParams
;
517 Bootstrap::get()->getFrom(
518 rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(UNO_JAVA_JFW_CLASSPATH_URLS
)),
520 #if OSL_DEBUG_LEVEL >=2
521 rtl::OString sValue
= rtl::OUStringToOString(sParams
, osl_getThreadTextEncoding());
522 fprintf(stderr
,"[Java framework] Using bootstrap parameter "
523 UNO_JAVA_JFW_CLASSPATH_URLS
" = %s.\n", sValue
.getStr());
530 static bool g_bMode
= false;
531 static JFW_MODE g_mode
= JFW_MODE_APPLICATION
;
533 if (g_bMode
== false)
535 //check if either of the "direct mode" bootstrap variables is set
536 bool bDirectMode
= true;
537 rtl::OUString sValue
;
538 const rtl::Bootstrap
* aBoot
= Bootstrap::get();
539 rtl::OUString
sJREHome(
540 RTL_CONSTASCII_USTRINGPARAM(UNO_JAVA_JFW_JREHOME
));
541 if (aBoot
->getFrom(sJREHome
, sValue
) == sal_False
)
543 rtl::OUString
sEnvJRE(
544 RTL_CONSTASCII_USTRINGPARAM(UNO_JAVA_JFW_ENV_JREHOME
));
545 if (aBoot
->getFrom(sEnvJRE
, sValue
) == sal_False
)
547 rtl::OUString
sClasspath(
548 RTL_CONSTASCII_USTRINGPARAM(UNO_JAVA_JFW_CLASSPATH
));
549 if (aBoot
->getFrom(sClasspath
, sValue
) == sal_False
)
551 rtl::OUString
sEnvClasspath(
552 RTL_CONSTASCII_USTRINGPARAM(UNO_JAVA_JFW_ENV_CLASSPATH
));
553 if (aBoot
->getFrom(sEnvClasspath
, sValue
) == sal_False
)
555 rtl::OUString sParams
= rtl::OUString(
556 RTL_CONSTASCII_USTRINGPARAM(UNO_JAVA_JFW_PARAMETER
)) +
557 rtl::OUString::valueOf((sal_Int32
)1);
558 if (aBoot
->getFrom(sParams
, sValue
) == sal_False
)
568 g_mode
= JFW_MODE_DIRECT
;
570 g_mode
= JFW_MODE_APPLICATION
;
577 rtl::OUString
getApplicationClassPath()
579 OSL_ASSERT(getMode() == JFW_MODE_APPLICATION
);
580 rtl::OUString retVal
;
581 rtl::OUString sParams
= BootParams::getClasspathUrls();
582 if (sParams
.isEmpty())
585 rtl::OUStringBuffer buf
;
587 char szClassPathSep
[] = {SAL_PATHSEPARATOR
,0};
590 ::rtl::OUString
token( sParams
.getToken( 0, ' ', index
).trim() );
591 if (!token
.isEmpty())
593 ::rtl::OUString systemPathElement
;
594 oslFileError rc
= osl_getSystemPathFromFileURL(
595 token
.pData
, &systemPathElement
.pData
);
596 OSL_ASSERT( rc
== osl_File_E_None
);
597 if (rc
== osl_File_E_None
&& !systemPathElement
.isEmpty())
599 if (buf
.getLength() > 0)
600 buf
.appendAscii( RTL_CONSTASCII_STRINGPARAM(
602 buf
.append( systemPathElement
);
607 return buf
.makeStringAndClear();
610 rtl::OString
makeClassPathOption(OUString
const & sUserClassPath
)
612 //Compose the class path
614 rtl::OUStringBuffer
sBufCP(4096);
615 char szSep
[] = {SAL_PATHSEPARATOR
,0};
617 // append all user selected jars to the class path
618 if (!sUserClassPath
.isEmpty())
619 sBufCP
.append(sUserClassPath
);
621 //append all jar libraries and components to the class path
622 OUString sAppCP
= getApplicationClassPath();
623 if (!sAppCP
.isEmpty())
625 if (!sUserClassPath
.isEmpty())
626 sBufCP
.appendAscii(szSep
);
627 sBufCP
.append(sAppCP
);
630 sPaths
= rtl::OUStringToOString(
631 sBufCP
.makeStringAndClear(), osl_getThreadTextEncoding());
633 rtl::OString
sOptionClassPath("-Djava.class.path=");
634 sOptionClassPath
+= sPaths
;
635 return sOptionClassPath
;
638 rtl::OString
getUserSettingsPath()
640 return getSettingsPath(BootParams::getUserData());
643 rtl::OString
getSharedSettingsPath()
645 return getSettingsPath(BootParams::getSharedData());
648 rtl::OString
getSettingsPath( const rtl::OUString
& sURL
)
651 return rtl::OString();
653 if (osl_getSystemPathFromFileURL(sURL
.pData
,
654 & sPath
.pData
) != osl_File_E_None
)
655 throw FrameworkException(
656 JFW_E_ERROR
, rtl::OString(
657 "[Java framework] Error in function ::getSettingsPath (fwkbase.cxx)."));
658 return rtl::OUStringToOString(sPath
,osl_getThreadTextEncoding());
661 rtl::OString
getVendorSettingsPath()
663 return getVendorSettingsPath(BootParams::getVendorSettings());
666 void setJavaSelected()
671 bool wasJavaSelectedInSameProcess()
673 //g_setJavaProcId not set means no Java selected
674 if (g_bJavaSet
== true)
682 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */