I had the same error and had a look here: https://docs.aws.amazon.com/corretto/latest/corretto-17-ug/generic-linux-install.html
You need to run the following before installing:
sudo rpm --import https://yum.corretto.aws/corretto.key
sudo curl -L -o /etc/yum.repos.d/corretto.repo https://yum.corretto.aws/corretto.repo
Answer from Tobsi on Stack OverflowI run Debian 12 and thought of installing jdk21, then by misstake wrote jdk17 and in the process messed something up when deleting jdk17. so no I have no JDK and when trying to install jdk17 I first get:
sudo apt-get install openjdk-17-jdk Reading package lists... Done Building dependency tree... Done Reading state information... Done Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable distribution that some required packages have not yet been created or been moved out of Incoming. The following information may help to resolve the situation: The following packages have unmet dependencies: openjdk-17-jre-headless : Depends: java-common (>= 0.28) but it is not installable E: Unable to correct problems, you have held broken packages.
I then try sudo apt-get install openjdk-17-jre-headless and get:
The following packages have unmet dependencies: openjdk-17-jre-headless : Depends: java-common (>= 0.28) but it is not installable E: Unable to correct problems, you have held broken packages.
I then try this: sudo apt-get install java-common and get:
E: Package 'java-common' has no installation candidate
My sources.d file look like this:
deb http://deb.debian.org/debian bookworm main contrib non-free non-free-firmware deb-src http://deb.debian.org/debian bookworm main contrib non-free non-free-firmware deb http://security.debian.org/debian-security bookworm-security main contrib non-free non-free-firmware deb-src http://security.debian.org/debian-security bookworm-security main contrib non-free non-free-firmware deb http://deb.debian.org/debian bookworm-updates main contrib non-free non-free-firmware deb-src http://deb.debian.org/debian bookworm-updates main contrib non-free non-free-firmware
What should I do to resolve this?
Installation fails with java-17-openjdk-17.0.5.0.8-1.fc37.x86_64
Unable to install Java 17
Problems installing Open JDK 17
rpm - OpenJDK 17 for CentOS 7 - Unix & Linux Stack Exchange
You might simply build this yourself. If it worked before, chances are the build for Fedora works. You will need a Fedora 34+ host to cross-build this.
# Don't build as root. Only need root privileges to install `fedpkg`,
sudo dnf install -y fedpkg
# Now get the package description
git clone https://src.fedoraproject.org/rpms/java-17-openjdk
# Use fedpkg to kick off a mock build
cd java-17-openjdk
fedpkg mockbuild --root centos-7-x86_64
This will take a while¹; and in the end, you should be getting a line that tells you where the RPMs you've just built were put.
¹ mock sets up a chroot, in which it installs a CentOS 7 base system, then EPEL, which you'll almost certainly will need, I think, then the tools necessary to build any RPM, then the build-time dependencies of the java-17-openjdk package. Then it will download all the necessary source code, hand off to rpm-build to do the build, which includes applying all patches, then compiling OpenJDK, then, running the OpenJDK installation, collecting the installed files, compressing them into valid RPMs.
Use Temurin. You'll need the Adoptium yum repo configuration from https://adoptium.net/installation/linux/
I don't know for sure the rational of the Intellij for (no longer?) including a link to a "vanilla" OpenJDK 17 download site. However my guess is that it is related to this notice on the https://jdk.java.net/17/ release page:
JDK 17 Releases
JDK 17 has been superseded. Please visit jdk.java.net for the current version.
Older releases, which do not include the most up to date security vulnerability fixes and are no longer recommended for use in production, remain available in the OpenJDK Archive.
Note that the OpenJDK team are no longer publishing new builds for OpenJDK 17. If you want the current Java 17 LTS build, you get it as an Oracle release or you get it from a 3rd-party vendor. These should all include the most recent security patches.
The Intellij team would be doing users a disservice if they provided an easy way for users to download an old and potentially insecure OpenJDK Java 17 build.
OpenJDK is basically a source only project (though they do release reference binaries for the first six months, which usually results in three releases, e.g. 17.0.0 - 17.0.2). After those three months, newer releases are only available through the vendors (e.g. for Java 17.0.5). All those listed are variants of OpenJDK 17 (except IBM Semeru, which is OpenJ9, which itself is a variant of OpenJDK). And bar vendor specific extras, or optional features like garbage collectors, they are basically the same, and have been tested for compliance with the Java specification.
In the Java world, you pick a vendor, and use its binaries instead of the binaries from OpenJDK itself (which generally don't go further then x.0.2, while vendor specific versions continue to receive updates if they are LTS versions). Personally, I usually use Eclipse Temurin builds.
For the past 7 hours, I've been trying to get my terminal's default Java version to be OpenJDK 17, but no matter what I try, it always ends up with me achieving absolutely nothing. When I list all Java versions, the only one that comes up is Java 8, when I should also see Java 11, 16, and 17, since they are all installed and visible in the jre folder. If you need any more details, leave a comment about them and I will give you an answer as soon as I can. Thanks in advance.
What os are you using, how did you install each Java version, and how are you listing installed Java versions?
Please ensure that:
-
Your code is properly formatted as code block - see the sidebar (About on mobile) for instructions
-
You include any and all error messages in full
-
You ask clear questions
-
You demonstrate effort in solving your question/problem - plain posting your assignments is forbidden (and such posts will be removed) as is asking for or giving solutions.
Trying to solve problems on your own is a very important skill. Also, see Learn to help yourself in the sidebar
If any of the above points is not met, your post can and will be removed without further warning.
Code is to be formatted as code block (old reddit: empty line before the code, each code line indented by 4 spaces, new reddit: https://imgur.com/a/fgoFFis) or linked via an external code hoster, like pastebin.com, github gist, github, bitbucket, gitlab, etc.
Please, do not use triple backticks (```) as they will only render properly on new reddit, not on old reddit.
Code blocks look like this:
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello World!");
}
}
You do not need to repost unless your post has been removed by a moderator. Just use the edit function of reddit to make sure your post complies with the above.
If your post has remained in violation of these rules for a prolonged period of time (at least an hour), a moderator may remove it at their discretion. In this case, they will comment with an explanation on why it has been removed, and you will be required to resubmit the entire post following the proper procedures.
To potential helpers
Please, do not help if any of the above points are not met, rather report the post. We are trying to improve the quality of posts here. In helping people who can't be bothered to comply with the above points, you are doing the community a disservice.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
The problem here is that you cannot use the Oracle rpm to install JDK 7 when you already have the Oracle JDK 6 as it tries to install the /etc/init.d/jexec script which is already installed and required for JDK 6.
I would advise sticking to the tarball or self extracting *.bin and using JAVA_HOME if you are going to use the Oracle distribution as it does not have this problem and you will probably not need jexec anyway.
In general I would suggest that you install the Oracle JDK not the OpenJDK. Otherwise you might risk running into some issues. I always found problems of all sorts and sizes with OpenJDK that I don't even bother trying it any more.
Download the JDK RPM from here and follow the usual instructions. Its usually very straightforward and without problems.
Full detailed instructions including how to install it here.
Make sure you choose the right version you need (JDK 1.7 or JDK 1.6, dont mix) because from your question you seem to have a confusion of library versions from 1.5 to 1.7.
And another thing, uninstall whatever you have installed already before installing a fresh one to avoid conflicts.
Finally I managed to install sources using
$ sudo apt install openjdk-17-doc openjdk-17-source
Then add them manually into intellij in
Project Structure/Platform settings/SDKs
from /usr/lib/jvm/openjdk-17/src.zip

Figured this out, thanks Ubuntu devs I guess for shipping stripped version of JDK by default, I keep telling that for workstation distros this fashion of headless just results in wasted time - include completely or don't include at all, it would be faster for myself to install adoptopenjdk correctly myself from scratch. Docker images or anything that goes on a server or in a cloud can be stripped - fine but not on Linux user distros, PLEASE
Solution:
Uninstall whatever openjdk-17 was installed including JRE and use the one with sources:
:~$ sudo apt install openjdk-17-source
instead of:
:~$ sudo apt install openjdk-17-jdk
as I've done at the question sample originally.
After this IntelliJ populates "Sourcepath" similarly as it does for internal Corretto and JavaDoc works.
While installing java jdk i also got the same type of this problem.to fibure that read terminal error carefully. It tells,
jdk-18 depends on libc6-i386; however:
Package libc6-i386 is not installed.
to figure this,
sudo apt --fix-broken install
After that unpack debian package again.
You need to install them together. I go through the process below.
Reproduced the error:
$ sudo dpkg -i jdk-17.0.1_linux-x64_bin.deb
(Reading database ... 181449 files and directories currently installed.)
Preparing to unpack jdk-17.0.1_linux-x64_bin.deb ...
Unpacking jdk-17 (17.0.1-ga) over (17.0.1-ga) ...
dpkg: dependency problems prevent configuration of jdk-17:
jdk-17 depends on libc6-i386; however:
Package libc6-i386 is not installed.
jdk-17 depends on libc6-x32; however:
Package libc6-x32 is not installed.
dpkg: error processing package jdk-17 (--install):
dependency problems - leaving unconfigured
Errors were encountered while processing:
jdk-17
Solution:
$ sudo apt-get install libc6-i386 libc6-x32
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following package was automatically installed and is no longer required:
systemd-hwe-hwdb
Use 'sudo apt autoremove' to remove it.
The following NEW packages will be installed:
libc6-i386 libc6-x32
0 to upgrade, 2 to newly install, 0 to remove and 99 not to upgrade.
1 not fully installed or removed.
Need to get 5,815 kB of archives.
After this operation, 25.4 MB of additional disk space will be used.
Get:1 http://au.archive.ubuntu.com/ubuntu jammy-updates/main amd64 libc6-i386 amd64 2.35-0ubuntu3.1 [2,837 kB]
Get:2 http://au.archive.ubuntu.com/ubuntu jammy-updates/main amd64 libc6-x32 amd64 2.35-0ubuntu3.1 [2,978 kB]
Fetched 5,815 kB in 1s (5,290 kB/s)
Selecting previously unselected package libc6-i386.
(Reading database ... 181449 files and directories currently installed.)
Preparing to unpack .../libc6-i386_2.35-0ubuntu3.1_amd64.deb ...
Unpacking libc6-i386 (2.35-0ubuntu3.1) ...
Selecting previously unselected package libc6-x32.
Preparing to unpack .../libc6-x32_2.35-0ubuntu3.1_amd64.deb ...
Unpacking libc6-x32 (2.35-0ubuntu3.1) ...
Setting up libc6-x32 (2.35-0ubuntu3.1) ...
Setting up libc6-i386 (2.35-0ubuntu3.1) ...
Setting up jdk-17 (17.0.1-ga) ...
Processing triggers for libc-bin (2.35-0ubuntu3.1) ...
Confirmation:
$ sudo dpkg -i jdk-17.0.1_linux-x64_bin.deb
(Reading database ... 182019 files and directories currently installed.)
Preparing to unpack jdk-17.0.1_linux-x64_bin.deb ...
Unpacking jdk-17 (17.0.1-ga) over (17.0.1-ga) ...
Setting up jdk-17 (17.0.1-ga) ...