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
Related
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
When I try to install something there is always this java dependency problem, I have working java version 1.8 but I don't know what i have done wrong.
On giving this command in ubuntu
sudo dpkg --configure -a
It results
Setting up oracle-java8-installer (8u121-1~webupd8~0) ...
debconf: DbDriver "config": /var/cache/debconf/config.dat is locked by another process: Resource temporarily unavailable
dpkg: error processing package oracle-java8-installer (--configure):
subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of oracle-java8-set-default:
oracle-java8-set-default depends on oracle-java8-installer; however:
Package oracle-java8-installer is not configured yet.
dpkg: error processing package oracle-java8-set-default (--configure):
dependency problems - leaving unconfigured
Errors were encountered while processing:
oracle-java8-installer
oracle-java8-set-default
How I can fix it?
Better install Open JDK:
sudo apt-get install openjdk-8-jdk
If you don't use testing repository, you can take:
Unable to locate package openjdk-8-jdk
In this case you must include testing repository or do this:
sudo apt-get install openjdk-7-jdk
Open JDK — it's JDK with open sources code. It better installs in Linux (and installs automatically). And Open JDK work absolute like Oracle JDK.
Try to clear sources.list (but make backup, I could be wrong) and paste in this file it:
deb http://01.archive.ubuntu.com/ubuntu/ trusty main
deb-src http://01.archive.ubuntu.com/ubuntu/ trusty main
Then make:
sudo apt-get autoclean
sudo apt-get -f install
sudo apt-get install openjdk-7-jdk
I want to compile my first java code but it is showing the following for javac :
The program 'javac' can be found in the following packages:
* default-jdk
* ecj
* gcj-4.6-jdk
* gcj-4.7-jdk
* openjdk-7-jdk
* openjdk-6-jdk
Try: sudo apt-get install <selected package>
I installed openjdk but still it is showing the same thing as above.
sudo apt-get install openjdk-7-jre
Reading package lists... Done
Building dependency tree
Reading state information... Done
openjdk-7-jre is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
The Java JRE will not include the command javac because it is the Java Runtime Environment.
You require a Java JDK -- Java Development Kit. Install openjdk-7-jdk instead.
The JRE (Java Runtime Environment) is not a JDK (Java Developers Kit). You need a JDK for javac.
sudo apt-get install openjdk-7-jdk
You have installed jre but to use javac you must install jdk.
sudo apt-get install default-jdk
install jdk
And then try again
I'm trying to use the jmap command on my CentOS server but it keeps telling me that the command was not found even though I have the JDK installed.
Here is the output of command java -version:
java version "1.7.0_25"
OpenJDK Runtime Environment (rhel-2.3.10.4.el6_4-x86_64)
OpenJDK 64-Bit Server VM (build 23.7-b01, mixed mode)
How can I fix this issue?
You should be able to find jmap in the java-1.8.0-openjdk-devel-debug, or java-1.7.0-openjdk-devel-debug, or java-1.6.0-openjdk-devel-debug packages on Redhat/Centos. To install it, run the following as root:
yum install java-1.8.0-openjdk-devel-debug
For completeness, here's the command to check which packages include jmap:
yum whatprovides '*/jmap'
Here's a sample output:
1:java-1.6.0-openjdk-devel-1.6.0.37-1.13.9.4.el7_1.x86_64 : OpenJDK Development Environment
Repo : updates
Matched from:
Filename : /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.37.x86_64/bin/jmap
1:java-1.7.0-openjdk-devel-1.7.0.91-2.6.2.3.el7.x86_64 : OpenJDK Development Environment
Repo : base
Matched from:
Filename : /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.91-2.6.2.3.el7.x86_64/bin/jmap
1:java-1.8.0-openjdk-devel-1.8.0.65-3.b17.el7.x86_64 : OpenJDK Development Environment
Repo : base
Matched from:
Filename : /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.65-3.b17.el7.x86_64/bin/jmap
1:java-1.8.0-openjdk-devel-debug-1.8.0.65-3.b17.el7.x86_64 : OpenJDK Development Environment with full debug on
Repo : base
Matched from:
Filename : /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.65-3.b17.el7.x86_64-debug/bin/jmap
1:java-1.8.0-openjdk-devel-debug-1.8.0.65-3.b17.el7.x86_64 : OpenJDK Development Environment with full debug on
Repo : #base
Matched from:
Filename : /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.65-3.b17.el7.x86_64-debug/bin/jmap
The following worked for me:
sudo apt-get install openjdk-8-jdk openjdk-8-dbg
My situation was a little strange (running inside the openjdk:8-jre Docker image), but this combination worked
cat /etc/debian_version # 8.6
apt install -t jessie-backports openjdk-8-jre-headless ca-certificates-java
apt-get install -f -y openjdk-8-jdk-headless
apt-get install -f -y openjdk-8-dbg
the java path must be in the "PATH" systemproperty.
$JAVA_HOME/bin
it doesn't come default with JRE -- you should be able to install it with below command
yum install java-1.8.0-openjdk-devel-debug
for Debian "buster" - 10.3 -
cat /etc/debian_version # 10.3
echo "deb http://ftp.us.debian.org/debian sid main" > /etc/apt/sources.list.d/buster.list
apt-get update && apt-get install -f -y openjdk-8-jdk-headless openjdk-8-dbg
OpenJDK on centos doesn't include the jmap utility. test on another platform or use the jhat java_pid1234.hprof command to examine the dump after the fact on another platform.
jhat can be slow to run on large dumps and even run out of memory! I use jhat -port 7000 -J-mx2048m java_pid1234.hprof so you'll need plenty of ram on your computer.
I found that on my system (elasticsearch container) it is excluded:
$ grep exclude /etc/yum.conf
exclude=java-1.8.0-openjdk*
If I comment it out then I can see and install this package with yum install ...