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
Related
I initially had default-jdk and default-jre installed on Ubuntu 18.04.
Attempted to host a Minecraft Server for a friend, but was given the error found here
I followed the commentor's advice to reinstall java version 8 rather than version 11 installed above, by following this advice here that being
sudo rm -r /usr/lib/jvm/java-11-oracle
but as a mistake I had removed all files in that folder, leaving just the two directories
java-11-openjdk-amd64
java-8-openjdk-amd64
since then I have attempted to reinstall java using sudo apt-get install default-jdk ; sudo apt-get install default-jre and they install just fine, but running java -version, either as root or as user, returns:
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
I have scoured askubuntu, digitalocean, and stackoverflow for some answers but I can't find anything that fixes this problem. I also asked my roommate, who is an experienced Computer Science major and who has used ubuntu extensively in the past, and he couldn't find a solution. Has anyone encountered this issue before?
I appreciate any and all responses 😊
Solution has been found. Running:
sudo apt purge -y openjdk-11-jre-headless
sudo apt purge -y openjdk-8-jre-headless
sudo apt purge -y default-jdk
and reinstalling has resolved the issue
Check your path. You should have remove the old jdk using apt-get. I think your system still assumes the old jdk-11 is still present. You could try to re-install it or use update-alternatives to switch to the other version.
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'm trying to install Java JDK 8 with this instruction:
apt-get update -y
apt-get install -y python-software-properties
add-apt-repository ppa:webupd8team/java
apt-get update -y
apt-get install -y oracle-java8-installer
but I get a 404 while I'm running last command:
Connecting to download.oracle.com
(download.oracle.com)|95.101.180.41|:80... connected. HTTP request
sent, awaiting response... 404 Not Found 2017-10-18 10:33:03 ERROR
404: Not Found.
download failed
How many days since this problems happens? It is strange a 404 for a Java installer. Isnt'it? Any workaround?
You can try to install java 8 manually.
Just download java (tar.gz) from oracle site.
Then, create directory for your jdk like (of course if folder doesn't exist)
$/opt/jdk
and extract java into created folder.
$tar -zxf jdk-8u152-linux-x64.tar.gz -C /opt/jdk
Then, it is very important, to set it as the default JVM in your machine run.
Just use that command:
$update-alternatives --install /usr/bin/java java /opt/jdk/jdk1.8.0_152/bin/java 100
and
$update-alternatives --install /usr/bin/javac javac /opt/jdk/jdk1.8.0_152/bin/javac 100
Now, verify that java installed correctly.
$java -version
A new SDK version is out and the old version is no longer available. Wait for a updated package, install manually or use OpenJDK.
Every time I try to install something from terminal this message pops up to me. Meanwhile I have my Java installed right:
download failed
Oracle JDK 9 is NOT installed.
dpkg: error processing package oracle-java9-installer (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
oracle-java9-installer
E: Sub-process /usr/bin/dpkg returned an error code (1)
Please can someone help me solve this; it's really annoying.
sudo apt-get purge oracle-java9-installer
solved my issue.
Later I also changed Ubuntu Software center server to "Main Server".
Actually I hit the issue after resolving the wine installation on my Ubuntu 16.04 LTS box. The wine issue I resolved using the below link.
https://askubuntu.com/questions/935050/unknown-error-class-keyerror-the-cache-has-no-package-named-wine1-6-i38
So that landed me to this post. But I was not able to install the java from apt packages. It threw me errors. Then I realized it was the issue of having multiple Java instances on my system. I already had Oracle Java 9 installed. I just needed to change the current verions using the command
sudo update-alternatives --config java
So if any body hits the error, you can try setting this.
I was getting the same error so using this command first i removed Java 9
sudo apt remove oracle-java9-installer
Then I made Java 8 as default
sudo apt-get install oracle-java8-set-default
After this if you try to install other software it will work or you can also upgrade Java 8 to Java 9.
First, add Oracle's PPA, then update your package repository.
$sudo add-apt-repository ppa:webupd8team/java
$sudo apt-get update
To install JDK 9, use the following command:
$sudo apt-get install oracle-java9-installer
I'm not sure what steps you have tried already to install it but the link below is a fairly well explained description of how to install the JDK on Ubuntu. I've always installed the JDK through the webupd8team's ppa and its worked for me so far :)
A note about the link, it suggests setting the home variable, this may be necessary for you but I've never had to it manually and it's worked so give it a quick check before setting the home variable yourself.
https://www.digitalocean.com/community/tutorials/how-to-install-java-with-apt-get-on-ubuntu-16-04
Solved the problem removing all java versions and purging them and re-installing them again probably, thanks everyone who tried to help.
Completely removal criteria:
To remove Oracle JDK completely, run the commands below:
sudo apt-get remove oracle-java9-installer
sudo apt-get remove --auto-remove oracle-java9-installer
sudo apt-get purge oracle-java9-installer
sudo apt-get purge --auto-remove oracle-java9-installer
Resource Link:
https://www.howtoinstall.co/en/ubuntu/trusty/tomcat7?action=remove
After that, install jdk9 using the following command:
Install JDK9 in Ubuntu:
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java9-installer
Make it as default:
sudo apt-get install oracle-java9-set-default
Resource Link:
http://zakirrizvi.blogspot.com/2017/10/install-jdk9-in-ubuntu.html
While installing oracle-java7-installer via ppa:webupd8team/java repository, I see the following error:
dpkg: error processing /var/cache/apt/archives/oracle-java7-installer_7u25-0~webupd8~1_all.deb (--unpack):
trying to overwrite '/usr/share/applications/JB-java.desktop', which is also in package oracle-java6-installer 6u37-0~eugenesan~precise1
Errors were encountered while processing:
/var/cache/apt/archives/oracle-java7-installer_7u25-0~webupd8~1_all.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
Do I need to delete the file /usr/share/applications/JB-java.desktop manually to make this installation work?
this is how i installed
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer
sudo apt-get install openjdk-6-jdk
I had to remove the package oracle-java6-installer
apt-get purge oracle-java6-installer
and then install oracle-java7-installer
apt-get install oracle-java7-installer
and it worked. But this isn't the recommended way.