问题
My system is Linux Mint 18.3 Cinnamon 64-bit.
I've installed IntelliJ-IDEA and Default-jdk (openjdk-8-jdk) using the software manager.
I can see what I believe to be the JDK folder under either /usr/lib/jvm/java-1.8.0-openjdk-amd64
or /etc/java-8-openjdk
when browsing with the file manager (Nemo) or the terminal. But it doesn't matter because IntelliJ can't see either folder anyway. In fact, when trying to Select Home Directory for JDK, IntelliJ only seems to have visibility to 14 sub-folders (out of hundreds) under /usr/lib
.
Not even sure how to launch IDEA from the command-line using sudo
, e.g. to test that the issue is permission-related, since it is apparently being launched vicariously via flatpak.
Seems like this should be simple. I'm not sure what I'm doing wrong.
回答1:
You can try installing IntelliJ IDEA from here and see if it works better. .tar.gz
distribution can be launched using ./idea.sh
. Note that you can also create a launcher script using Tools>Create Command-line Launcher. This should work with any version.
回答2:
I had the same problem with IntelliJ installed with Flatpak on Fedora 29. I believe (but correct me if I'm wrong) that Linux Mint's Software Manager also uses flatpaks.
It turns out this is one of those "it's a feature not a bug" situations due to the way Flatpak sandboxes applications. As per the documentation at http://docs.flatpak.org/en/latest/sandbox-permissions.html:
Sandbox Permissions One of Flatpak’s main goals is to increase the security of desktop systems by isolating applications from one another. This is achieved using sandboxing and means that, by default, applications that are run with Flatpak have extremely limited access to the host environment. This includes:
No access to any host files except the runtime, the app and ~/.var/app/$APPID. Only the last of these is writable. No access to the network. No access to any device nodes (apart from /dev/null, etc). No access to processes outside the sandbox. Limited syscalls. For instance, apps can’t use nonstandard network socket types or ptrace other processes. Limited access to the session D-Bus instance - an app can only own its own name on the bus. No access to host services like X11, system D-Bus, or PulseAudio. Most applications will need access to some of these resources in order to be useful. This is primarily done during the finishing build stage, which can be configured through the finish-args section of the manifest file (see Manifests).
One way around this is to install JDK versions using flatpak as well, eg.
flatpak install flathub org.freedesktop.Sdk.Extension.openjdk9 org.freedesktop.Sdk.Extension.openjdk10 org.freedesktop.Sdk.Extension.openjdk11
Another way around this is the solution CrazyCoder provided, which is to install IntelliJ using their tar.gz. This eliminates the entire sandbox constraint altogether.
回答3:
As others said - sandboxing is a feature not a bug.
I think @Kevin Dubois's answer should perhaps be preferred where applicable (you can install via flatpak the thing you want to share), but there is another solution to this problem if you would like to continue using flatpak
How to find /etc
and /usr
paths in a flatpak:
As mentioned at the end of this section of the documentation, these two directories are mounted under these new paths in flatpakked software:
/etc
at/var/run/host/etc
/var
at/var/run/host/var
How to find other paths in a flatpak:
NB: It is generally a good idea to give software as little extra access as possible. That's why it is preferable to use the optional :ro
suffix when granting access to a path to make it accessible in read-only. You will also be partly responsible if some software abuses the access it has to your device.
Examples using the path /var/lib/gems
and the flatpak com.jetbrains.IntelliJ-IDEA-Community
:
To grant access:
sudo flatpak override --filesystem="/var/lib/gems":ro com.jetbrains.IntelliJ-IDEA-Community
To check current permissions:
flatpak info --show-permissions com.jetbrains.IntelliJ-IDEA-Community
To forbid access:
sudo flatpak override --nofilesystem="/var/lib/gems" com.jetbrains.IntelliJ-IDEA-Community
To reset permissions:
sudo flatpak override --reset com.jetbrains.IntelliJ-IDEA-Community
There's some useful path variables in the filesystem permissions reference and a lot of additional information about filesystem permissions here.
来源:https://stackoverflow.com/questions/54499133/cant-select-home-directory-for-jdk-because-intellij-cant-see-it