java: Updated macOS Java Path detector and docs to current JDK file structure (#1031)

This commit is contained in:
Eberhard Gräther
2020-06-01 23:42:02 +02:00
committed by GitHub
parent ef8b9e0031
commit a3abdf7c04
3 changed files with 13 additions and 3 deletions
+2 -2
View File
@@ -513,14 +513,14 @@
<pre>&lt;path_to_jre&gt;/bin/client/jvm.dll</pre>
<h3>macOS</h3>
<p>The Java Runtime Library (called <code>libjli.dylib</code>) can be found inside of your JRE install folder. Run the following command in your terminal to find the location of your default Java installation:</p>
<p>The Java Runtime Library (called <code>libjli.dylib</code>) can be found inside of your JDK install folder. Run the following command in your terminal to find the location of your default Java installation:</p>
<pre>/usr/libexec/java_home</pre>
<p>This should give you a path looking like this:</p>
<pre>/Library/Java/JavaVirtualMachines/&lt;jdk_version&gt;/Contents/Home</pre>
The <code>"libjli.dylib"</code> should be available at:
<pre>/Library/Java/JavaVirtualMachines/&lt;jdk_version&gt;/Contents/Home/jre/lib/jli/libjvm.dylib</pre>
<pre>/Library/Java/JavaVirtualMachines/&lt;jdk_version&gt;/Contents/MacOS/libjli.dylib</pre>
<p>Insert the full path to <code>libjli.dylib</code> into the <strong>Java Path</strong> setting in the <a href="#PreferencesWindow">Preferences Window</a>.</p>
@@ -358,7 +358,7 @@ void QtProjectWizardContentPreferences::populate(QGridLayout* layout, int& row)
m_javaPath->setFileFilter(
QStringLiteral("JLI or JVM Library (libjli.dylib libjvm.dylib)"));
m_javaPath->setPlaceholderText(
QStringLiteral("<jre_path>/Contents/Home/jre/lib/jli/libjli.dylib"));
QStringLiteral("/Library/Java/JavaVirtualMachines/<jdk_version>/Contents/MacOS/libjli.dylib"));
break;
case OS_LINUX:
m_javaPath->setFileFilter(QStringLiteral("JVM Library (libjvm.so)"));
@@ -18,6 +18,16 @@ std::vector<FilePath> JavaPathDetectorMac::doGetPaths() const
std::string output = utility::executeProcess(command.c_str()).second;
if (!output.empty())
{
javaPath = FilePath(utility::trim(output) + "/../MacOS/libjli.dylib").makeCanonical();
}
if (!javaPath.exists() && output.size())
{
javaPath = FilePath(utility::trim(output) + "/lib/libjli.dylib");
}
if (!javaPath.exists() && output.size())
{
javaPath = FilePath(utility::trim(output) + "/jre/lib/jli/libjli.dylib");
}