Ubuntu: OpenJDK 8 — Unable to locate package
Any help would be appreciated. In the meantime, I’m just gonna use the Oracle package. Thanks.
So, now I have a new problem. I installed OpenJDK 7, it came with Maven and just installed before I realized I was getting a two-for-one deal. Now I have JDK 7, and Eclipse, and Maven, and they’re all working, but I’m stuck on JDK 7 rather than 8.
I saw that there’s a link below, I intend to check it out in the morning, it’s 2am and I’m tired right now. Any other advice for this new issue would be appreciated, otherwise I will definitely be checking out that link first thing in the morning.
What version of Ubuntu are you running? The latest couple of versions have had it available as an installation option.
Thanks. It’s 2am, so I’m going to bed, but I’ll check the link in the morning. I added an edit to my question with an additional issue, if you could look it over that would be great. If the existing link/answer will help with that too, I apologize for being too tired to look at it right now, I’ll be checking it out in the morning.
13 Answers 13
UPDATE: installation without root privileges below
I advise you to not install packages manually on ubuntu system if there is already a (semi-official) repository able to solve your problem. Further, use Oracle JDK for development, just to avoid (very sporadic) compatibility issues (i’ve tried many years ago, it’s surely better now).
Add the webupd8 repo to your system:
sudo add-apt-repository ppa:webupd8team/java sudo apt-get update
Install your preferred version of jdk (versions from java-6 to java-9 available):
sudo apt-get install oracle-java8-installer
You can also install multiple version of jdk, mixing openjdk and oracle versions. Then you can use the command update-java-alternatives to switch between installed version:
# list available jdk update-java-alternatives --list # use jdk7 sudo update-java-alternatives --set java-7-oracle # use jdk8 sudo update-java-alternatives --set java-8-oracle
Requirements
If you get add-apt-repository: command not found be sure to have software-properties-common installed:
sudo apt-get install software-properties-common
If you’re using an older version Ubuntu:
sudo apt-get install python-software-properties
JDK installation without root privileges
If you haven’t administrator rights on your target machine your simplest bet is to use sdkman to install the zulu certified openjdk:
curl -s "https://get.sdkman.io" | bash source "$HOME/.sdkman/bin/sdkman-init.sh" sdk install java
NOTE: sdkman allow to install also the official Oracle JDK, although it’s not a the default option. View available versions with:
Install the chosen version with:
sdk install java 9.0.1-oracle
Glossary of commands
- sudo[command_arguments] : execute a command with the superuser privilege.
- add-apt-repository: Ubuntu (just like every Debian derivatives and generally speaking every Linux distribution) has a main repository of packages that handle things like package dependencies and updating. In Ubuntu is possible to extend the main repository using a PPA (Personal Package Archive) that usually contains packages not available in the system (just like oracle jdk) or updated versions of available ones (example: LibreOffice 5 in LTS is available only through this PPA).
- apt-get [install|update|upgrade|purge|. ] : it’s «the» command-line package handler used to manipulate the state of every repository on the system (installing / updating / upgrading can be viewed as an alteration of the repository current state).
In our case: with the command sudo add-apt-repository ppa:webupd8team/java we inform the system that the next repository update must retrieve packages information also from webupd8 repo.
With sudo apt-get update we actually update the system repository (all this operations requires superuser privileges, so we prepend sudo to the commands).
sudo apt-get install oracle-java8-installer
- update-java-alternatives (a specific java version of update-alternatives): in Ubuntu several packages provides the same functionality (browse the internet, compile mails, edit a text file or provides java/javac executables. ). To allows the system to choose the user favourites tool given a specific task a mechanism using symlinks under /etc/alternatives/ is used. Try to update the jdk as indicated above (switch between java 7 and java 8) and view how change the output of this command: ls -l /etc/alternatives/java*
In our case: sudo update-java-alternatives —set java-8-oracle update symlinks under /etc/alternatives to point to java-8-oracle executables.
- man: start using man to read a really well written and detailed help on (almost) every shell command and its options (every command i mention in this little answer has a man page, try man update-java-alternatives ).
- apt-cache search : query the APT cache to search for a package related with the search_key provided (can be the package name or some word in package description).
- apt-cache show : provides APT information for a specific package (package version, installed or not, description).
Установка java 1.8.0 на Kali Linux virtualbox
Говорю сразу. нужна именно эта версия. Задаю вопрос, после нескольких блужданий в интернете. Перепробовал все. Замену с помощью Waw, удалением и прочим. Знатоки, помогите подробным советом. Заранее спасибо.
Пожалуйста, исправьте вопрос, чтобы он отражал конкретную проблему с достаточным количеством деталей для возможности дать адекватный ответ.
1 ответ 1
Picked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=on -Dswing.aatext=true openjdk 11.0.12 2021-07-20 OpenJDK Runtime Environment (build 11.0.12+7-post-Debian-2) OpenJDK 64-Bit Server VM (build 11.0.12+7-post-Debian-2, mixed mode, sharing)
sudo apt-get install openjdk-8-jdk
Reading package lists. Done Building dependency tree. Done Reading state information. Done E: Unable to locate package openjdk-8-jdk
Переходим на сайт https://jdk.java.net/java-se-ri/8-MR3 и качаем Oracle Linux 7.6 x64 Java Development Kit (md5) 167 MB. Распаковываем в /usr/lib/jvm/ и переименовываем папку в java-8 .
update-alternatives --list java
/usr/lib/jvm/java-11-openjdk-amd64/bin/java
Поочередно в терминал вводим команды:
sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/java-8/bin/java 1 sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/java-8/bin/javac 1 sudo update-alternatives --install /usr/bin/jar jar /usr/lib/jvm/java-8/bin/jar 1 sudo update-alternatives --install /usr/bin/jshell jshell /usr/lib/jvm/java-8/bin/jshell 1
update-alternatives: error: alternative path /usr/lib/jvm/java-8/bin/jshell doesn't exist
update-alternatives --display java
java - auto mode link best version is /usr/lib/jvm/java-11-openjdk-amd64/bin/java link currently points to /usr/lib/jvm/java-11-openjdk-amd64/bin/java link java is /usr/bin/java slave java.1.gz is /usr/share/man/man1/java.1.gz /usr/lib/jvm/java-11-openjdk-amd64/bin/java - priority 1111 slave java.1.gz: /usr/lib/jvm/java-11-openjdk-amd64/man/man1/java.1.gz /usr/lib/jvm/java-8/bin/java - priority 1
sudo update-alternatives --config java
There are 2 choices for the alternative java (providing /usr/bin/java). Selection Path Priority Status ------------------------------------------------------------ * 0 /usr/lib/jvm/java-11-openjdk-amd64/bin/java 1111 auto mode 1 /usr/lib/jvm/java-11-openjdk-amd64/bin/java 1111 manual mode 2 /usr/lib/jvm/java-8/bin/java 1 manual mode Press to keep the current choice[*], or type selection number:
Вводим цифру 2 и нажимаем Enter
update-alternatives: using /usr/lib/jvm/java-8/bin/java to provide /usr/bin/java (java) in manual mode
Командой sudo update-alternatives —config java проверяем, что теперь выбрана нужная версия java :
There are 2 choices for the alternative java (providing /usr/bin/java). Selection Path Priority Status ------------------------------------------------------------ 0 /usr/lib/jvm/java-11-openjdk-amd64/bin/java 1111 auto mode 1 /usr/lib/jvm/java-11-openjdk-amd64/bin/java 1111 manual mode * 2 /usr/lib/jvm/java-8/bin/java 1 manual mode Press to keep the current choice[*], or type selection number:
Нажимаем Ctrl + C и выходим.
Picked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=on -Dswing.aatext=true openjdk version "1.8.0_41" OpenJDK Runtime Environment (build 1.8.0_41-b04) OpenJDK 64-Bit Server VM (build 25.40-b25, mixed mode)
Необходимая версия установлена.
Saved searches
Use saved searches to filter your results more quickly
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot install openjdk-8-jre and openjdk-8-jdk #448
Cannot install openjdk-8-jre and openjdk-8-jdk #448
Comments
Describe the bug
Try to install openjdk-8-jre & openjdk-8-jdk both from pengwin-setup and apt command get the same error:
$ apt-get install openjdk-8-jre openjdk-8-jdk -y
Reading package lists. Done
Building dependency tree
Reading state information. Done
E: Unable to locate package openjdk-8-jre
E: Unable to locate package openjdk-8-jdk
To Reproduce
Steps to reproduce the behavior:
Expected behavior
openjdk-8-jre and openjdk-8-jdk package should be successfully installed
Additional context
Add any other context about the problem here.
Basic Troubleshooting Checklist
[] I have searched Google for the error message.
[] I have checked official WSL troubleshooting documentation: https://docs.microsoft.com/en-us/windows/wsl/troubleshooting#confirm-wsl-is-enabled.
[] I have searched the official Microsoft WSL issues page: https://github.com/Microsoft/WSL/issues.
[] I have searched the Pengwin issues page: https://github.com/WhitewaterFoundry/Pengwin/issues.
[] I have reset Pengwin: Settings->Apps->Apps & features->Pengwin->Advanced Options->Reset.
[] I have run Windows 10 updates and restarted.
What other troubleshooting have you attempted?
Insert here:
Try to use stretch backport still not help
Pengwin Version
Find: Settings->Apps->Apps & features->Pengwin->Advanced Options->Version.
Insert here:
1.2.3.0
Windows Build
Run ‘systeminfo | findstr /C:»OS»‘ in Command Prompt and insert here:
OS Version: 10.0.17763 N/A Build 17763
For help on retrieving: https://docs.microsoft.com/en-us/windows/wsl/troubleshooting#check-your-build-number
The text was updated successfully, but these errors were encountered: