openSUSE install Oracle JDK error - java-8

OS: openSUSE Leap 42.3
When I install OracleJDK error!
$ sudo rpm -ivh jdk-8u151-linux-x64.rpm
[sudo] root 的密码:
准备中... ################################# [100%]
正在升级/安装...
1:jdk1.8-2000:1.8.0_151-fcs ################################# [100%]
Unpacking JAR files...
tools.jar...
plugin.jar...
javaws.jar...
deploy.jar...
rt.jar...
jsse.jar...
charsets.jar...
localedata.jar...
update-alternatives: error: alternative pack200 can't be slave of java: it is a slave of javac
update-alternatives: error: alternative keytool can't be slave of javac: it is a slave of java
警告:%post(jdk1.8-2000:1.8.0_151-fcs.x86_64) 脚本执行失败,退出状态码为 2
In fact, Java files have been written to the hard disk.
$ ls -l /usr/java
总用量 8
lrwxrwxrwx 1 root root 16 12月 9 14:08 default -> /usr/java/latest
drwxr-xr-x 1 root root 284 12月 9 14:08 jdk1.8.0_151
lrwxrwxrwx 1 root root 22 12月 9 14:08 latest -> /usr/java/jdk1.8.0_151
```
But, the Java version does not switch.
$ java -version
openjdk version "1.8.0_151"
OpenJDK Runtime Environment (IcedTea 3.6.0) (build 1.8.0_151-b12 suse-18.1-x86_64)
OpenJDK 64-Bit Server VM (build 25.151-b12, mixed mode)
I can not use update-alternatives to switch Java versions without doing anything else.
$ sudo update-alternatives --config java
There is only one alternative in link group java (providing /usr/bin/java): /usr/lib64/jvm/jre-1.8.0-openjdk/bin/java
Nothing to configure.
So, I want to know:
Why is there such a mistake, all openSUSE version will have such a problem?
What is the most formal way to switch Java versions?

Related

E: Unable to locate package openjdk-11-jdk

I try to create docker image:
It is my Dockerfile:
FROM maven:3-jdk-11
# Common files and utils for build
RUN apt-get update && apt-get install -y make fakeroot rpm dpkg-dev apt-utils wget unzip
RUN apt-get install -y -q software-properties-common desktop-file-utils
# Then Wine with all deps
RUN dpkg --add-architecture i386 && apt-get update
RUN apt-get install -y --install-recommends wine
RUN apt-cache search openjdk
RUN apt-get install -y openjdk-11-jdk
RUN apt install -y openjfx11 libopenjfx-java libopenjfx-jni
RUN apt-get install -y --install-recommends wine32
ENV JAVA_HOME /usr/lib/jvm/java-11-openjdk-amd64
ENV JAVAFX_HOME /usr/share/java/openjfx11
# And we ready to play with our code
ARG SRCDIR=.
ARG DSTDIR=/usr/src/CryptoStock
ARG CACHEDIR=./cache
# Subject to be used here but should be command line, sic!
# ADD ${CACHEDIR} /root/.m2
# ADD ${SRCDIR} /mnt/src
RUN mkdir -p /root/.m2/repository
COPY settings.xml /root/.m2/settings.xml
COPY settings-security.xml /root/.m2/settings-security.xml
COPY jdk11-build-in-docker.sh ${DSTDIR}/jdk11-build-in-docker.sh
COPY ./static/. ${DSTDIR}/static
COPY ./3rdparty/. ${DSTDIR}/3rdparty
COPY ./winjdk11/. ${DSTDIR}/winjdk
ENV SOURCES /usr/src/CryptoStock
ENV OUTSIDE /mnt/src
RUN dpkg -l '*openjfx*'
RUN dpkg -l '*jdk*'
WORKDIR ${DSTDIR}
CMD [ "sh", "/usr/src/CryptoStock/jdk11-build-in-docker.sh" ]
When I try to build I don't to watch java 11:
Step 6/27 : RUN apt-cache search openjdk
---> Running in e03b4c69fa69
jtreg - Regression Test Harness for the OpenJDK platform
openjdk-8-dbg - Java runtime based on OpenJDK (debugging symbols)
openjdk-8-demo - Java runtime based on OpenJDK (demos and examples)
openjdk-8-doc - OpenJDK Development Kit (JDK) documentation
openjdk-8-jdk - OpenJDK Development Kit (JDK)
openjdk-8-jdk-headless - OpenJDK Development Kit (JDK) (headless)
openjdk-8-jre - OpenJDK Java runtime, using Hotspot JIT
openjdk-8-jre-headless - OpenJDK Java runtime, using Hotspot JIT (headless)
openjdk-8-jre-zero - Alternative JVM for OpenJDK, using Zero/Shark
openjdk-8-source - OpenJDK Development Kit (JDK) source files
openjdk-8-jre-dcevm - Alternative VM for OpenJDK 8 with enhanced class redefinition
uwsgi-plugin-jvm-openjdk-8 - Java plugin for uWSGI (OpenJDK 8)
uwsgi-plugin-jwsgi-openjdk-8 - JWSGI plugin for uWSGI (OpenJDK 8)
uwsgi-plugin-ring-openjdk-8 - Closure/Ring plugin for uWSGI (OpenJDK 8)
uwsgi-plugin-servlet-openjdk-8 - JWSGI plugin for uWSGI (OpenJDK 8)
Removing intermediate container e03b4c69fa69
---> 1fae3b35c58b
Step 7/27 : RUN apt-get install -y openjdk-11-jdk
---> Running in 288fb5247ce6
Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package openjdk-11-jdk
The command '/bin/sh -c apt-get install -y openjdk-11-jdk' returned a non-zero code: 100
There is only java 8, there is no java 11.
OpenJDK 11 is installed by default in the maven:3-jdk-11 image:
$ docker run maven:3-jdk-11 java --version
openjdk 11.0.16 2022-07-19
OpenJDK Runtime Environment 18.9 (build 11.0.16+8)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.16+8, mixed mode, sharing)
It is also available via the Debian package system:
$ docker run maven:3-jdk-11 sh -c 'apt update && apt-cache search openjdk-11'
[...]
openjdk-11-dbg - Java runtime based on OpenJDK (debugging symbols)
openjdk-11-demo - Java runtime based on OpenJDK (demos and examples)
openjdk-11-doc - OpenJDK Development Kit (JDK) documentation
openjdk-11-jdk - OpenJDK Development Kit (JDK)
openjdk-11-jdk-headless - OpenJDK Development Kit (JDK) (headless)
openjdk-11-jre - OpenJDK Java runtime, using Hotspot JIT
openjdk-11-jre-headless - OpenJDK Java runtime, using Hotspot JIT (headless)
openjdk-11-jre-zero - Alternative JVM for OpenJDK, using Zero
openjdk-11-source - OpenJDK Development Kit (JDK) source files
[...]
Today the maven:3-jdk-11 image is using Debian 11 (Bullseye), but when you wrote your question the maven:3-jdk-11 image was probably using a Debian 9 (Stretch) image with OpenJDK 11 installed but not available through the Debian package system. This explains your error.

jdk path for oracle java installation by ppa repository

I have installed oracle java on ubuntu via ppa repository. Now I want to extract the jdk path of the installation. I looked intto the following path as follows:
/usr/lib/jvm/java-8-oracle/
But I do not see any jdk installed under this path. Once I type the command
javac -version
I do get the following:
javac 1.8.0_144
So it means that JDK is installed by PPA as well. I need some hint to locate the JDK path.
Type which java on the command line and it will tell you where on the path it is finding the executable.
That file may itself be a symbolic link. You can ls -l the file to see where it is linked. You may then need to do so again if there are more levels of links. E.g.:
paul#pcb ~ $ which java
/usr/bin/java
paul#pcb ~ $ ls -l /usr/bin/java
lrwxrwxrwx 1 root root 22 Nov 16 2015 /usr/bin/java -> /etc/alternatives/java
paul#pcb ~ $ ls -l /etc/alternatives/java
lrwxrwxrwx 1 root root 39 May 11 14:48 /etc/alternatives/java -> /usr/lib/jvm/java-8-oracle/jre/bin/java
paul#pcb ~ $

java_home error: change version of java or hadoop-env.sh file?

When installing Single Node Setup for Hadoop 2.6.0 on Mac 10.7.5, the manual http://hadoop.apache.org/docs/r1.2.1/single_node_setup.html requires to update java_home.
Namely,
In Prepare to Start the Hadoop Cluster section, it says:
"In the distribution, edit the file conf/hadoop-env.sh to define at least JAVA_HOME to be the root of your Java installation."
I use the result of terminal query '/usr/libexec/java_home', which is
/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home,
for the value of java_home.
As a result, hadoop scripts do not work due to error: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home: bad substitution.
The mistake is likely to be due to mismatch of currently installed on Mac.
My Java is 8.0_25 and the one hadoop uses is 6.0_05 (preferably from Sun). Also, this is the path of jdk and not jre, as may be needed.
Unfortunately, I have not found any java ire 1.6.x for any x for Mac OS in Oracle Java archives. http://www.oracle.com/technetwork/java/javase/downloads/java-archive-downloads-javase6-419409.html
Hadoop requires jdk 1.6 or higher. For finding the location of already installed java, do the following steps.
In the linux command line type the command which java
This may give you a location if java is already installed and added to path.
Type ll
This will give you the exact location where the java is present.
Eg:
which java
/usr/bin/java
ls -all /usr/bin/java
lrwxrwxrwx 1 root root 22 Sep 17 09:43 /usr/bin/java -> /etc/alternatives/java
ls -all /etc/alternatives/java
lrwxrwxrwx 1 root root 35 Sep 17 09:43 /etc/alternatives/java -> /usr/lib/jvm/jdk1.7.0_60/bin/java
In this case, the value of JAVA_HOME will be /usr/lib/jvm/jdk1.7.0_60
Use this value and add it in the hadoop-env.sh
Eg:
export JAVA_HOME=/usr/lib/jvm/jdk1.7.0_60
If jdk is not present, you have to install jdk.
You mentioned about JRE. You should use JDK. JDK for MAC is available in oracle website.
http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html
The installation document that you are following is of version 1.2.1 and the hadoop version that you have is 2.6.0. Use the proper installation document.
http://hadoop.apache.org/docs/r2.6.0/hadoop-project-dist/hadoop-common/SingleCluster.html

Can't run `bzr explorer` on Mac OS 10.9.x

Unfortunately, the answer to this question did not answer my problem. :(
I have the following installed:
$ python
Python 2.7.5 (default, Mar 9 2014, 22:15:05)
$ brew install qt
Warning: qt-4.8.6 already installed
$ brew install pyqt
Warning: pyqt-4.11.1 already installed
$ brew install sip
Warning: sip-4.16.3 already installed
Then when I try to run bzr explorer, it returns the following:
$ bzr explorer
bzr: ERROR: No module named PyQt4
You may need to install this Python library separately.
I am running on Mac OS 10.9.x.
My /Users/me/.bazaar/plugins directory have the following:
$ ll
total 0
drwxr-xr-x 25 me staff 850 Oct 9 15:21 explorer
drwxr-xr-x 20 me staff 680 Oct 9 15:22 qbzr
What am I missing?

Updating Ant on mac

I am running ant 1.8.2 and I want to up date to the latest on my mac. What is the best way to do this? Should I remove then install or can i write over the previous?
I use it in both Eclipse and from the command line. I also have jenkins call ant targets. It's currently set in /usr/local
I found these two links to update Ant on mac:
Seventy6.com
Ninjascript.com
I had Ant 1.8.4 installed on my Mac 10.8.5 and upgraded to:
Apache Ant(TM) version 1.9.4 compiled on April 29 2014
The first website from seventy6 said all of the below, with a few updates from myself.
To see what version you currently have installed run this:
$ ant -version
Apache Ant version 1.7.1 compiled on February 11 2010
I was advised to use the simple OSX package installer homebrew. I’m not going to discuss how to install this, as they have a really simple guide. However, it’s not obvious how to install Apache Ant as it’s not one of the packages they list. So here is the brew to get started:
$brew install https://raw.github.com/adamv/homebrew-alt/master/duplicates/ant.rb
EDIT: You can also just install now with homebrew just by typing the following
$brew install ant
Beware, you might need to install Apple’s XCode, which if you’re still running OS X 10.6 or lower (like me) you can’t install the latest version (4) via the wonderful (?) AppStore. Ha! fun and games! Luckily, I have an Apple Developer account which allows you to download archived releases of Apple’s software. I created this ages ago and assume they’re still free to do… Once installed it puts the package here:
/usr/local/Cellar/ant/1.8.2
I then scratched my head for a while as to how to get OSX to use the newly installed version. It seems the easiest option is to remove the symlink currently set for the system. Run this to see where this is:
$ whereis ant
/usr/bin/ant //returned message
So we need to remove the symlink and set it to our new installed copy. I found this article which got me started. Useful, but not perfect for a homebrew package install. So here is the final commands to change the symlink to the homebrew version:
$ cd /usr/share
$ sudo rm /usr/share/ant
Password:
************
$ ln -s /usr/local/Cellar/ant/1.8.2 ant
You now need to close your current terminal session and open a new one. In theory you should be able to run 'ant -version' to get the latest version…
$ ant -version
Apache Ant(TM) version 1.8.2 compiled on December 20 2010
I’m not sure if it’s best way to do it. But it’s a simple technique which can easily be updated if needed. At least you haven’t removed the base Java install of Ant from your system!
DONE
Also from blog.ninjascript.com, I saw this was interesting to know about:
Now Ant is kind of buried in OS X; the $PATH variable points to a symlink which points to another symlink. To find out where ant really is, just follow the chain:
$ which ant
/usr/bin/ant
$ ls -la /usr/bin/ant
lrwxr-xr-x 1 root wheel 22 Nov 11 18:04 /usr/bin/ant -> /usr/share/ant/bin/ant
$ ls -la /usr/share/ant
lrwxr-xr-x 1 root wheel 14 Nov 11 18:04 /usr/share/ant -> java/ant-1.7.1
$ ls -la /usr/share/java/ant-1.7.1
total 40
drwxr-xr-x 8 root wheel 272 Feb 27 12:32 .
drwxr-xr-x 8 root wheel 272 Nov 11 18:04 ..
-rw-r--r-- 1 root wheel 15289 Feb 10 2010 LICENSE.txt
-rw-r--r-- 1 root wheel 1270 Feb 10 2010 NOTICE.txt
drwxr-xr-x 8 root wheel 272 Feb 10 2010 bin
drwxr-xr-x 3 root wheel 102 Feb 10 2010 docs
drwxr-xr-x 15 root wheel 510 Feb 10 2010 etc
drwxr-xr-x 44 root wheel 1496 Feb 27 12:09 lib

Resources