lok: vcl: fix multiple floatwin removal case more robustly.
[LibreOffice.git] / jvmfwk / plugins / sunmajor / pluginlib / sunjre.cxx
blob1e833a9faeef02bee369e8f666245ac5d540fb91
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 .
21 #include <osl/thread.h>
22 #include "sunjre.hxx"
23 #include "sunversion.hxx"
24 #include "diagnostics.h"
26 using namespace std;
28 namespace jfw_plugin
31 rtl::Reference<VendorBase> SunInfo::createInstance()
33 return new SunInfo;
36 char const* const* SunInfo::getJavaExePaths(int * size)
38 static char const * ar[] = {
39 #if defined(_WIN32)
40 "java.exe",
41 "bin/java.exe",
42 "jre/bin/java.exe"
43 #elif defined UNX
44 "java",
45 "bin/java",
46 "jre/bin/java"
47 #endif
49 *size = SAL_N_ELEMENTS(ar);
50 return ar;
53 char const* const* SunInfo::getRuntimePaths(int * size)
55 static char const* ar[]= {
56 #if defined(_WIN32)
57 "/bin/client/jvm.dll",
58 "/bin/hotspot/jvm.dll",
59 "/bin/classic/jvm.dll",
60 "/bin/jrockit/jvm.dll",
61 // The 64-bit JRE has the jvm in bin/server
62 "/bin/server/jvm.dll"
63 #elif defined MACOSX && defined X86_64
64 // Oracle Java 7, under /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home
65 "/lib/server/libjvm.dylib",
66 "/lib/jli/libjli.dylib"
67 #elif defined UNX
68 "/lib/" JFW_PLUGIN_ARCH "/client/libjvm.so",
69 "/lib/" JFW_PLUGIN_ARCH "/server/libjvm.so",
70 "/lib/" JFW_PLUGIN_ARCH "/classic/libjvm.so",
71 "/lib/" JFW_PLUGIN_ARCH "/jrockit/libjvm.so",
72 "/lib/server/libjvm.so"
73 #endif
75 *size = SAL_N_ELEMENTS(ar);
76 return ar;
79 char const* const* SunInfo::getLibraryPaths(int* size)
81 #if defined UNX && !defined MACOSX
82 static char const * ar[] = {
83 "/lib/" JFW_PLUGIN_ARCH "/client",
84 "/lib/" JFW_PLUGIN_ARCH "/server",
85 "/lib/" JFW_PLUGIN_ARCH "/native_threads",
86 "/lib/" JFW_PLUGIN_ARCH
88 *size = SAL_N_ELEMENTS(ar);
89 return ar;
90 #else
91 *size = 0;
92 return nullptr;
93 #endif
96 int SunInfo::compareVersions(const OUString& sSecond) const
98 OUString sFirst = getVersion();
100 SunVersion version1(sFirst);
101 JFW_ENSURE(version1, "[Java framework] sunjavaplugin" SAL_DLLEXTENSION
102 " does not know the version: "
103 + sFirst + " as valid for a SUN/Oracle JRE.");
104 SunVersion version2(sSecond);
105 if ( ! version2)
106 throw MalformedVersionException();
108 if (version1 == version2)
109 return 0;
110 if (version1 > version2)
111 return 1;
112 else
113 return -1;
119 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */