I use ubuntu 18.04, when I launch
sudo apt install openjdk-9-jdk
I get the following message
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package openjdk-9-jdk
how do I install it correctly?
Thanks
Sergio
Tested with Ubuntu 18.04 docker image:
It did not have a package openjdk-9-jdk it only provides openjdk-8-jdk and openjdk-11-jdk. The 9 version is superseded by the 11 version (see http://jdk.java.net/9/). So it is recommended to use the openjdk-11-jdk if possible.
Check with:
sudo apt-cache search openjdk
If you really need the 9er version get it manually via http://jdk.java.net/archive/.
Related
Package oracle-java7-installer is not available, but is referred to by another package.
This may mean that the package is missing,that has been obsoleted, or
is only available from another source
oracle-java7-installeris no longer available from their ppa:webupd8team/java repository, and that would make sense now that Java 8 is out. Try installing Java 8 and see if the problem still persists.
As of March 22, 2019, it appears that oracle-java7-installer is no longer available from the ppa:webupd8team/java upstream repo (it could be that it got move to a different archive repo).
Alternatively, you can install oracle-java8-installer instead if you have the apt repo setup properly.
Previously its work with below steps-
Oracle JDK 6 and 7 are not available by default in Ubuntu 18.04/16.04 repositories and requires you to add repositories for the same as follows:
$ sudo add-apt-repository ppa:webupd8team/java (If you find upstream repo Update on this line and follw below steps)
$ sudo apt-get update
You may now run your command and enjoy using Java.
If you get error while installing ppa:repository, you will need to re-install ca certificates as follows:
$ sudo apt-get install --reinstall ca-certificates
Once this is done try running first two commands again.
I tried to install latest stable Jenkins version which supports Java 11. So after installing Java 11(JDK) I got the error from Jenkins that incorrect java version was found.
So uninstalled the Java 11 and tried to install Java 8. While installing java 8, the Jenkins message "incorrect java version found" was repeatedly coming. So I completely removed both Java 11(JDK) and Java 8(JDK) and made sure no folders are there in /usr/bin and /usr/lib/jvm for both java 11 and java 8. When I installed java 8 the system says JDK 8 installed but im not able to find any java version in my system. Why?
I tried both sudo apt install openjdk-8-jre-headless and sudo apt install openjdk-8-jdk but java is not there in /usr/bin and /usr/lib/jvm has java8jdk but it doesn't have java in bin folder. Please see the command and the console output below.
sudo apt install openjdk-8-jdk
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
daemon net-tools
Use 'sudo apt autoremove' to remove them.
Suggested packages: openjdk-8-demo openjdk-8-source visualvm
The following NEW packages will be installed
openjdk-8-jdk
0 upgraded, 1 newly installed, 0 to remove and 14 not upgraded.
Need to get 0 B/1,435 kB of archives. After this operation, 1,538 kB of additional disk space will be used.
Selecting previously unselected package openjdk-8-jdk:amd64. (Reading database ... 168837 files and directories currently installed.)
Preparing to unpack .../openjdk-8-jdk_8u191-b12-2ubuntu0.18.04.1_amd64.deb ...
Unpacking openjdk-8-jdk:amd64 (8u191-b12-2ubuntu0.18.04.1) ...
Setting up openjdk-8-jdk:amd64 (8u191-b12-2ubuntu0.18.04.1) ..
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/bin/appletviewer to provide /usr/bin/appletviewer (appletviewer) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/bin/jconsole to provide /usr/bin/jconsole (jconsole) in auto mode
When I tried openjdk-jre-headless I got the below
sudo apt install openjdk-8-jre-headless
Reading package lists... Done
Building dependency tree Reading state information... Done
openjdk-8-jre-headless is already the newest version (8u191-b12-2ubuntu0.18.04.1).
The following packages were automatically installed and are no longer required:
daemon libice-dev libpthread-stubs0-dev libsm-dev libx11-dev libx11-doc libxau-dev libxcb1-dev libxdmcp-dev libxt-dev net-tools openjdk-8-jdk-headless x11proto-core-dev x11proto-dev xorg-sgml-doctools xtrans-dev
Use 'sudo apt autoremove' to remove them. 0 upgraded, 0 newly installed, 0 to remove and 14 not upgraded
Still no use. I am not able to find java. which java returns nothing. java -version returns following.... Command 'java' not found, but can be installed with: sudo apt install default-jre sudo apt install openjdk-11-jre-headless sudo apt install openjdk-8-jre-headless
Could someone please help me on this issue? How to install java correctly?
After removing/uninstalling Jenkins also I tried to install java but no use. Is jenkins that I installed previously blocking any java installaion?
Have you tried to add Java to your Environment Variables?
Check your installed Java Versions and select the desired version
sudo update-alternatives --config java
Export your Java Path as enviroment variable
export PATH=$PATH:/usr/java/jrex.x.x_xxx/bin/
Add this line to your .bashrc file in your home dircetory. This will update your evironment variable when opening bash
Maybe this answer could help you.
I have a Ubuntu host on which i have installed OpenJDK 10 and Gloud SDK using APT. When i try to install 'google-cloud-sdk-datastore-emulator', i get the error shown below.
I found a thread on GCP GitHub that talks about this but its closed. Here - https://github.com/GoogleCloudPlatform/cloud-sdk-docker/issues/144
Anyone else having this issue?
Error -
# apt install google-cloud-sdk-datastore-emulator
Reading package lists... Done
Building dependency tree
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:
google-cloud-sdk-datastore-emulator : Depends: openjdk-8-jdk but it is not installable
E: Unable to correct problems, you have held broken packages.
My Environment -
OS -
DISTRIB_RELEASE=18.04
DISTRIB_CODENAME=bionic
DISTRIB_DESCRIPTION="Ubuntu 18.04.2 LTS"
NAME="Ubuntu"
VERSION="18.04.2 LTS (Bionic Beaver)"
OpenJDK -
#java -version
openjdk version "10.0.2" 2018-07-17
OpenJDK Runtime Environment (build 10.0.2+13-Ubuntu-1ubuntu0.18.04.4)
OpenJDK 64-Bit Server VM (build 10.0.2+13-Ubuntu-1ubuntu0.18.04.4, mixed mode)
#javac -version
javac 10.0.2
#which java
/usr/bin/java
Gcloud sdk -
# gcloud -v
Google Cloud SDK 234.0.0
alpha 2019.02.08
beta 2019.02.08
bq 2.0.41
core 2019.02.08
gsutil 4.36
kubectl 2019.02.08
There's some issue with our debian package dependancy config.
Although if you install the emulator via gcloud command it should work:
gcloud components install cloud-datastore-emulator
(https://cloud.google.com/sdk/gcloud/reference/components/install)
Note the components manager doesn't work if sdk is insalled from other package managers. In this case you can remove it and install following the suggestion here: stackoverflow.com/questions/42697026
If for some other reason you do have to install via apt-get, https://serverfault.com/questions/250224 should help, basically avoid install openjdk by:
apt-get install google-cloud-sdk-datastore-emulator openjdk-8-jdk-
Note there's a "-" after the openjdk-8-jdk
Or you can follow the steps in the same thread to update package dependancy.
My solution involved using equivs to create a fake openjdk-8-jdk package (of course you need to make sure you have another JDK).
apt-get install equivs
equivs-control openjdk-8-jdk
vim openjdk-8-jdk # especially change the package name, but I also used 11.0.0 as a version (although it's probably not needed)
equivs-build openjdk-8-jdk
dpkg -i openjdk-8-jdk*.deb
I'm trying to install mysql on my Mac using the command
sudo apt install mysql
and it said I needed to install JDK on it. So I installed JDK but am receiving an error saying:
Unable to locate an executable at "/Library/Java/JavaVirtualMachines/jdk-9.jdk/Contents/Home/bin/apt" (-1)
I have updated my env path to
JAVA_HOME=/Library/Java/Home
But when I install JDK theres no java file anywhere in my library, even though when I check to see if I have installed it, it is successfully found. I've installed Homebrew but do not know what package to install after the initial installation, or if this is the problem.
Any help would be appreciated.
If you are using Mac it would be much easier to install Homebrew from https://brew.sh and then use $ brew install mysql
see this link for the apt and yum command usage
I have been following this tutorial, and at step 5, I am getting the following output from GCC:
HelloWorld.c:1:17: error: jni.h: No such file or directory
In file included from HelloWorld.c:3:
HelloWorld.h:15: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘void’
HelloWorld.c:5: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘void’
I know that he include directories vary from system to system, so I tried to adapt the command accordingly, but I cannot seem to find the correct directory on my system. I am using Ubuntu 10.04LTS.
Open up a terminal and type:
locate jni.h
That should tell you where every file called jni.h is on your system. I am on ubuntu 11.04, and it's located at:
/usr/lib/jvm/java-6-openjdk/include/jni.h
/usr/lib/jvm/java-6-sun-1.6.0.26/include/jni.h
You may also need to get it from the repos:
sudo apt-get install openjdk-6-jdk
should do the trick if you don't have it installed.
jni.h lives with JDK. For me it is: jdk1.6.0_25/include/.
And by default, I don't think Ubuntu would have JDK with development libraries, so download latest JDK version from Oracle and install it somewhere.
Or you can install openjdk as #Leif suggested if it works on 10.04 LTS. Although, I personally, prefer the one from Sun/Oracle.
In Ubuntu 14.04 run:
sudo apt-get install openjdk-7-jdk openjdk-7-jre-lib
Now, you have a headers into /usr/lib/jvm/java-7-openjdk-amd64/include
For OpenJDK 6:
sudo apt-get install openjdk-6-jdk openjdk-6-jre-lib