Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
525 views
in Technique[技术] by (71.8m points)

java - Can't Select Home Directory for JDK because IntelliJ can't see it?

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...