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
Related
I am trying to run a .java file, but when I compile the file I get this error
Command 'javac' not found, but can be installed with:
apt install default-jdk
apt install openjdk-11-jdk-headless
apt install ecj
apt install openjdk-8-jdk-headless
But I have java jdk installed and when I check i get this message
openjdk version "11.0.5" 2019-10-15
OpenJDK Runtime Environment (build 11.0.5+10-post-Ubuntu-0ubuntu1.118.04)
OpenJDK Server VM (build 11.0.5+10-post-Ubuntu-0ubuntu1.118.04, mixed mode, sharing)
I need this for a course I am taking and when I try installing one of the listed files, I get this.
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
default-jdk : Depends: default-jdk-headless (= 2:1.11-68ubuntu1~18.04.1) but it is not going to be installed
Depends: openjdk-11-jdk but it is not going to be installed
linux-image-generic : Depends: linux-image-4.15.0-74-generic but it is not going to be installed
linux-modules-extra-4.15.0-74-generic : Depends: linux-image-4.15.0-74-generic but it is not going to be installed or
linux-image-unsigned-4.15.0-74-generic but it is not installable
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
Looks like you have JRE installed. You'll need to install JDK as well to get javac (the Java compiler). Just use one of the apt commands suggested.
If you have jdk installed then seems you need to update your path variable. This should fix the issue.
export PATH=/path/to/your/jdk1.8.0/bin:$PATH
Does anybody know how I can install Java 13.0.1 on a RaspberryPi 4?
Because I use [Java 13.0.1]1 on my WindowsEngine and so I wrote and exported my JavaApplication with Java 13.0.1 but the RaspberryPi only supports a licensed Version of Java 11.0.5 which is not available for free.
Surprised nobody has posted about this yet; you can totally install recent versions of Java on Raspbian.
In this example, I'll be using an AdoptOpenJDK OpenJDK build to install Java 14 on Raspbian Stretch.
# 1) Download the armhf jdk14 binary
wget 'https://adoptopenjdk.jfrog.io/adoptopenjdk/deb/pool/main/a/adoptopenjdk-14-hotspot/adoptopenjdk-14-hotspot_14.0.0+36-2_armhf.deb'
# 2) now install it, and don't worry if it spits out a ton of errors, this is normal
sudo dpkg -i 'adoptopenjdk-14-hotspot_14.0.0+36-2_armhf.deb'
# 3) install missing dependencies
sudo apt-get install -f
And that's it! Running java -version now yields:
$ java -version
openjdk version "14" 2020-03-17
OpenJDK Runtime Environment AdoptOpenJDK (build 14+36)
OpenJDK Server VM AdoptOpenJDK (build 14+36, mixed mode, sharing)
Ok,
I decided to download Java 11.0.5 to my windows engine and build the JavaProjects as a Java 11.0.5 Application.
Paying for any version of Java is getting ripped off: don't do it ever, unless you need to comply with licensing for a professional project (or something).
There isn't currently something you can install from apt-get, but Bell-SW has Java 13 packages for ARMv7 (you just have to scroll down) and they have instructions for how to install.
https://bell-sw.com/pages/java-13.0.2/
For free.
or just use the AdoptOpenJDK repos:
echo "deb https://adoptopenjdk.jfrog.io/adoptopenjdk/deb buster main" | sudo tee /etc/apt/sources.list.d/adoptopenjdk.list
wget -qO - https://adoptopenjdk.jfrog.io/adoptopenjdk/api/gpg/key/public | sudo apt-key add -
sudo apt-get update
apt-cache search adoptopenjdk
sudo apt-get install adoptopenjdk-15-hotspot
Those are the condensed instructions for Linux RPM and DEB installer packages
apt-cache search adoptopenjdk - shows a list of packages (versions) available (incl. v8 & v11)
If you want/need to build JDK, you can start with this gist.
I tried install open-jdk for react-native.But i encountered some problem. How can i solve it ? Thanks
$ sudo apt update
$ sudo apt install default-jdk
Reading package lists... Done
Building dependency tree
Reading state information... Done
default-jdk is already the newest version (2:1.11-68ubuntu1~18.04.1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
5 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up oracle-java11-installer-local (11.0.4-1~linuxuprising1) ...
Before installing this package,
please download the Oracle JDK 11 .tar.gz file
with the same version as this package (version 11.0.4),
and place it in /var/cache/oracle-jdk11-installer-local,
E.g.:
sudo mkdir -p /var/cache/oracle-jdk11-installer-local
sudo cp jdk-11.0.4_linux-x64_bin.tar.gz /var/cache/oracle-jdk11-
installer-local/
sha256sum mismatch jdk-11.0.4_linux-x64_bin.tar.gz
Oracle JDK 11 is NOT installed.
dpkg: error processing package oracle-java11-installer-local (--
configure):
installed oracle-java11-installer-local package post-installation
script subprocess returned error exit status 1
dpkg: dependency problems prevent configuration of default-jre:
default-jre depends on openjdk-11-jre; however:
Package openjdk-11-jre is not installed.
Package oracle-java12-installer which provides openjdk-11-jre is
not
installed.
Package oracle-java11-installer-local which provides openjdk-11-jre
is not configured yet.
Errors were encountered while processing:
oracle-java11-installer-local
default-jre
default-jdk
default-jre-headless
default-jdk-headless
E: Sub-process /usr/bin/dpkg returned an error code (1)
I tried remove java and java's repo and re-install but no response.
Sorry my English.
Edit
If i run this code:
java -version
give the output:
openjdk version "1.8.0_212"
OpenJDK Runtime Environment (build 1.8.0_212-8u212-b03-
0ubuntu1.18.04.1-b03)
OpenJDK 64-Bit Server VM (build 25.212-b03, mixed mode)
I don't use Java with Android Studio.
Try these commands:
add repository
sudo add-apt-repository ppa:openjdk-r/ppa
update the packages
sudo apt-get update
Install OpenJDK 8:
sudo apt-get install openjdk-8-jdk
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/.
I'm working on MacOS and just starting with react-native.
One of the first steps to get started is to run: react-native run-android or react-native run-ios. But I'm getting this error:
react-native run-android
Result:
Scanning folders for symlinks in /Users/ric/myprojs/albums/node_modules (6ms)
Starting JS server...
Building and installing the app on the device (cd android && ./gradlew installDebug)...
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine java version from '9.0.1'.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/android-setup.html
This is what I get when I run java --version:
java --version
Result:
java 9.0.1
Java(TM) SE Runtime Environment (build 9.0.1+11)
Java HotSpot(TM) 64-Bit Server VM (build 9.0.1+11, mixed mode)
mbp:albums ric$ java --version
java 9.0.1
Java(TM) SE Runtime Environment (build 9.0.1+11)
Java HotSpot(TM) 64-Bit Server VM (build 9.0.1+11, mixed mode)
Edit
My javac version:
javac --version
Result:
javac 9.0.1
Any idea on how to fix this?
In your PROJECT_PATH/android/gradle/wrapper/gradle-wrapper.properties file, update your distributionUrl to the following:
distributionUrl=https\://services.gradle.org/distributions/gradle-5.0-all.zip
See related gradle distributions documentation
Really the fastest way to get around this error is to use JDK 8. Except when you really need to use JDK9.
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
Don't forget to change your enviroment variable JAVA_HOME to the new JDK version!
Make sure that you have JDK8 installed and then set JAVA_HOME into JDK8
for example:
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_151.jdk/Contents/Home
or use .bash_* files to set this variable
vi ~/.bash_profile
Then add the following lines:
export ANDROID_HOME=$HOME/Library/Android/sdk
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/tools/bin
export PATH=$PATH:$ANDROID_HOME/platform-tools
export JAVA_HOME=$(/usr/libexec/java_home -v 1.8)
Now source the file to make the above changes effective in the current shell:
source ~/.bash_profile
On MacOS, I ran the following commands:
brew cask uninstall java
brew tap caskroom/versions
brew cask install java8 "or just brew cask install java to install latest version"
I was getting this error, but for a more recent version of Java - 10.0.2.
To fix my error, I followed the steps mentioned by #Blacktoviche in this Github issue: https://github.com/facebook/react-native/issues/17688
When I opened the android folder inside my project via Android Studio, I was prompted with Android Gradle plugin update recommended. At the time, I was following a slightly outdated tutorial that told me to click Don't remind me again for this project.
However, as #Blacktoviche recommended in the github issue linked above, sometimes it's necessary to update the Gradle plugin. After updating, I also had to click Install Build Tools 27... and sync project (I don't remember the exact version).
After I followed these steps, I was able to successfully run my react native app on the Android Studio emulator.
Hope this helps someone!
---- December 2018 --- keep attention ---
React Native does not work with Java versions higher than 8, so you need to uninstall your 9.0.1 version. To do so, execute the following commands:
cd /Library/Java/JavaVirtualMachines/
ls -l
Identify the folder containing your Java Version, then remove it
sudo rm -rf jdk.x.x_xxx.jdk
After that you can download and install java 8 from oracle again. Refer to jdk8 download page
If you are using windows; Make sure you add your jdk path to the Environment path variable.
Then open your android folder from your react native project into android studio. It will update necessary things for you automatically.
I usually get this error when I forget to build the project using Android Studio. A simple sync and upgrading Gradle will do the work.
I solve this by downgrading my JDK to 8.
On Ubuntu, you should run these command lines in the terminal:
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt install oracle-java8-installer
sudo apt install oracle-java8-set-default