debian apt cant find openjdk-8-jdk - java

im trying to install openjdk-8-jdk as suggested here with the command:
sudo apt-get install openjdk-8-jdk
but apt dosnt find the package. i did find it at packages.debian.org manualy and tried to tell apt to also load from there, as suggested on the mirrors page of that package by adding the following line to /etc/apt/sources.list
deb http://ftp.de.debian.org/debian sid main
but apt still cant find the package. i also tried to change the
url to http://deb.debian.org/debian
sid to buster or buster-backports
main to unstable, non-free, contrib (or a list of some or all of those)
combinations of all of the above
still no luck.

add the following line to /etc/apt/sources.list
deb http://deb.debian.org/debian/ sid main
install openjdk8
//Update the repositories
$ sudo apt-get update
$ sudo apt-get install -y openjdk-8-jdk
In fact, I think it is better to search for your question first before ask.
How to install openjdk-8-jdk on Debian 10 (Buster)?

Related

Install java inside a docker

I'm trying to install java on my docker to be able to use a node module (... yes ...)
I've been searching and I found multiple way of doing it but it always throw an error so, I'm gonna show you what I use for now
RUN apt-get update
RUN apt-get install -y --no-install-recommends software-properties-common
RUN add-apt-repository -y ppa:openjdk-r/ppa
RUN apt-get update
RUN apt-get install -y openjdk-8-jdk
RUN apt-get install -y openjdk-8-jre
RUN update-alternatives --config java
RUN update-alternatives --config javac
switching grom java 8 to java 11 throw the same error:
W: The repository 'http://ppa.launchpad.net/openjdk-r/ppa/ubuntu impish Release' does not have a Release file.
E: Failed to fetch http://ppa.launchpad.net/openjdk-r/ppa/ubuntu/dists/impish/main/binary-amd64/Packages 404 Not Found
E: Some index files failed to download. They have been ignored, or old ones used instead.
If someone could help me understand what I'm missing that could be cool !
This is a way to stop the problem. The reason why I why trying to use this RUN add-apt-repository -y ppa:openjdk-r/ppa is because without I was getting this error
E: Sub-process /usr/bin/dpkg returned an error code (1)
But after some research I found this way of using java inside my docker:
RUN apt-get -y update
RUN mkdir -p /usr/share/man/man1/
RUN apt-get install -y openjdk-8-jdk
RUN apt-get install -y openjdk-8-jre
RUN update-alternatives --config java
RUN update-alternatives --config javac
The second line fixed the problem by creating the right folder

Installing rJava package with Docker

I am trying to install the 'rJava' package in my RStudio docker image using my Dockerfile:
FROM rocker/tidyverse:3.6.1
RUN mkdir -p /rstudio
RUN mkdir -p /rscripts
RUN apt-get update && \
apt-get install -y openjdk-11-jdk && \
apt-get install -y liblzma-dev && \
apt-get install -y libbz2-dev
RUN R -e "install.packages(c('rJava','mailR'))"
Following this SO post I added the above part with the apt-get commands but still I get the same error:
java libs :
'-L/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/amd64/server -ljvm'
checking whether Java run-time works... ./configure: line 3766:
/usr/bin/java: No such file or directory no configure: error: Java
interpreter '/usr/bin/java' does not work ERROR: configuration failed
for package ‘rJava’
So there is a missing file or directory but I don't know what changes I should make.
[EDIT 1]:
So, following Dirk's suggestion, I entered in the rstudio container and ran apt-get install r-cran-rjava which seems to work.
But when I install rJava package I get a new error:
error: Cannot compile a simple JNI program. Make sure you have Java
Development Kit installed and correctly registered in R. If in doubt,
re-run "R CMD javareconf" as root.
I tried to enter again in the container and run R CMD javareconf but that did not change the error. I also tried the following commands found on this article:
sudo apt-get install default-jre
sudo apt-get install default-jdk
But I still get:
Cannot compile a simple JNI program.
I found a github repo suggesting to add these steps in the Dockerfile before installing R package rJava and it worked:
RUN apt-get -y update && apt-get install -y \
default-jdk \
r-cran-rjava \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/
This is a duplicate of similar answers I have already given in the Debian / Ubuntu context. The fact that you are using Docker does not matter: you should still simply install the binary!
edd#rob:~$ docker run --rm -ti r-base bash
root#ef4bb9726a21:/# apt update -qq
73 packages can be upgraded. Run 'apt list --upgradable' to see them.
root#ef4bb9726a21:/# apt install --no-install-recommends -y r-cran-rjava
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
ca-certificates-java default-jre default-jre-headless java-common libasound2 libasound2-data libavahi-client3 libavahi-common-data libavahi-common3 libcups2 libdbus-1-3 libdrm-amdgpu1 libdrm-common
libdrm-intel1 libdrm-nouveau2 libdrm-radeon1 libdrm2 libedit2 libgif7 libgl1 libgl1-mesa-dri libglapi-mesa libglvnd0 libglx-mesa0 libglx0 liblcms2-2 libllvm10 libnspr4 libnss3 libpciaccess0 libpcsclite1
libsensors-config libsensors5 libsqlite3-0 libvulkan1 libx11-xcb1 libxcb-dri2-0 libxcb-dri3-0 libxcb-glx0 libxcb-present0 libxcb-sync1 libxdamage1 libxfixes3 libxi6 libxshmfence1 libxtst6 libxxf86vm1 libz3-4
openjdk-11-jre openjdk-11-jre-headless
[.... many lines skipped ....]
Running hooks in /etc/ca-certificates/update.d...
done.
done.
root#ef4bb9726a21:/# R
R version 4.0.3 (2020-10-10) -- "Bunny-Wunnies Freak Out"
Copyright (C) 2020 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
[...some lines skipped...]
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(rJava)
>
The reason why Dirk's answer doesn't work for you is because you're using rocker/tidyverse as a base image instead of the r-base that Dirk is using.
In the rocker/tidyverse documentation on Docker Hub they are discouraging the use of apt install --no-install-recommends -y r-cran-rjava:
do not use apt-get install r-cran-* to install R packages on this stack. The requested R version and all R packages are installed from source in the version-stable stack. Installing R packages from apt (e.g. the r-cran-* packages) will install the version of R and versions of the packages that were built for the stable debian release (e.g. debian:stretch), giving you a second version of R and different packages. Please install R packages from source using the install.packages() R function (or the install2.r script), and use apt only to install necessary system libraries (e.g. libxml2). If you would prefer to install only the latest verions of packages from pre-built binaries using apt-get, consider using the r-base stack instead.
Since rJava is supposed to be installed with apt install r-cran-rjava, but the rocker/... base images explicitly tell you not to do that, it looks like you will not be able to use rJava with any of the rocker/... base images..

How do I put Java onto a Ubuntu docker container?

I currently have a docker container with an Ubuntu(17.10) image installed with other packages included. However, I'm currently having difficulty trying to install Java onto this container in addition to the current image.
Current Dockerfile :
FROM cityofzion/neo-privatenet
ADD files/ files/
ENTRYPOINT [ "/bin/bash" ]
When trying to find information on how to do this and testing inside of the container most suggest using this command: apt-get install -y oracle-java9-installer
However this results in:E: Unable to locate package oracle-java9-installer
I have also tried this suggested command wget http://download.java.net/java/GA/jdk9/9/binaries/jdk-9+181_linux-x64_bin.tar.gz
Which produces this result HTTP request sent, awaiting response...
404 Not Found - ERROR 404: Not Found.
I have only tried running these commands in the container, since that is how they would be run and they seem to be failing.
Can anyone suggest what I can include into my Dockerfile that install java onto my image?
Thanks in advance.
You can also directly pull any of the open-jdk images mentioned at (https://hub.docker.com/_/openjdk/) and use it. There is no need to install Ubuntu in docker image and then install Java on top of it. These images already use Ubuntu (with bare-minimum file system).
add to to your docker file
RUN \
apt-get update && \
apt-get install -y software-properties-common && \
echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | debconf-set-selections && \
add-apt-repository -y ppa:webupd8team/java && \
apt-get update && \
apt-get install -y oracle-java9-installer && \
rm -rf /var/lib/apt/lists/* && \
rm -rf /var/cache/oracle-jdk8-installer
ENV JAVA_HOME /usr/lib/jvm/java-9-oracle
Following from here
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
Oracle JDK version 7
sudo apt-get install oracle-java7-installer
Oracle JDK version 8
sudo apt-get install oracle-java8-installer

How to use django-pipeline in a virtual-env?

I have been using django-pipeline successfully for a couple of months. Now I have installed virtual-env for the first time on a clean system. Everything is accordingly set and all pip installs are done within my environment.
python manage.py collectstatic
Now I get an error when I am collecting my static files, it says
File "/vc/cb-env/local/lib/python2.7/site-packages/pipeline/compressors/__init__.py", line 247, in execute_command
raise CompressorError(error)
pipeline.compressors.CompressorError: [warning] /usr/bin/yui-compressor: No java runtime was found
[warning] /usr/bin/yui-compressor: No JAVA_CMD set for run_java, falling back to JAVA_CMD = java
Even though both yui-compressor as well as latest java were installed previously:
sudo add-apt-repository ppa:webupd8team/java -y
sudo apt-get update
sudo apt-get install oracle-java7-installer -y
sudo apt-get install yui-compressor -y
By the look of it, because I had installed java as root, my environment doesn't seem to find it.
What can I do?
Not a direct solution but after some research and chat with the maker of django-pipeline it seems that Yui-Compressor is deprecated anyway and replaced by Yuglify.
Hence its best to keep the django settings.py as it is and simply install Yuglify instead.
sudo apt-get install npm
(switch your virtualenv's environment)
npm install yuglify
The settings.py needs to change only one line:
PIPELINE_YUI_BINARY = '/vc/{your-project-env}/site/{your-project}/node_modules/yuglify/bin/yuglify'
Thats it and it works.
UPDATE:
In the latest django-pipeline You can't set the YUI binary to Yuglify anymore.
You have explicitely declare the yuglify binary. But otherwise nothing changes:
PIPELINE_YUGLIFY_BINARY = "/vc/{yourproject-env}/node_modules/yuglify/bin/yuglify"

issue with installing java package on ec2

I was trying to install java using the following command:
sudo add-apt-repository ppa:ferramroberto/java
sudo apt-get update
sudo apt-get install sun-java6-jre sun-java6-plugin sun-java6-fonts
during the installation for some reason my micro-instance in EC2 kept on freezing, I guess I am not the only one having this issue as it's posted on the aws forum as well. Now when I try to do the whole thing again I get:
E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem.
However, when I try to run sudo dpkg --configure -a, it is just stuck in here:
Setting up sun-java6-bin (6.26-1lucid1) ...
for about an hour or so... WHat should I do now to get java in place?
It could be that the repository you added doesn't have the 'right' version of java6, personally I would use canonical's repository.
First I would try to uninstall the packages and repo
sudo apt-get remove sun-java6-jre sun-java6-plugin sun-java6-fonts
sudo remove-apt-repository ppa:ferramroberto/java
And then use canonical's aptitude repository.
sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"
sudo apt-get update
sudo apt-get install sun-java6-jdk
I thinks its the same Bug: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/634487
issue fix
E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem.
pd#admin:~$ sudo dpkg --configure -a
dpkg: error: parsing file '/var/lib/dpkg/updates/0024' near line 0: newline in field name `#padding'
pd#admin:~$ sudo rm /var/lib/dpkg/updates/0024
pd#admin:~$ sudo dpkg --configure -a
pd#admin:~$ sudo apt-get install appname_mention_here
Reading package lists... Done
Building dependency tree
Reading state information... Done
Now its working the installation....!
Simply use Open JDK like so...
sudo apt-get install openjdk-6-jre-headless
since you can only ssh into anyway... :)

Categories