centos using older version of java - java

I want to install open office in my centos linux and as part of the requirement is jdk 11.0.2 version.
I installed new version of java JDK 11.0.2 however when I use the command java -version it is still showing that it is using old version of java.
java -version
openjdk version "1.8.0_262"
OpenJDK Runtime Environment (build 1.8.0_262-b10)
OpenJDK 64-Bit Server VM (build 25.262-b10, mixed mode)
i created the file /etc/profile.d/jdk11.sh and ran the command below
"source /etc/profile.d/jdk11.sh"
the file contains
export JAVA_HOME=/usr/local/jdk-11.0.2
export PATH=$PATH:$JAVA_HOME/bin

Given that you are using centOS:
try the following command:
sudo update-alternatives --config java
It should show you the list of available Java versions in your system. You can switch using the numbers shown in the result of the command.

Related

Update Java version in Windows 10 WSL

I had openjdk 11.0.2 installed. I upgraded the java version by running
sudo apt update
sudo apt install openjdk-11-jdk
If I run sudo apt install openjdk-11-jdk again, it shows a message saying that "openjdk-11-jdk is already the newest version (11.0.11+9-0ubuntu2~20.04)"
However, when I do java -version it displays the older version 11.0.2 not 11.0.11
openjdk version "11.0.2" 2019-01-15
OpenJDK Runtime Environment 18.9 (build 11.0.2+9)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.2+9, mixed mode)
The JAVA_HOME still shows "/opt/java/jdk-11.0.2", so I guess this might be the problem that the java -version is still showing the older version?
When I do whereis java it shows
java: /usr/bin/java /usr/share/java /opt/java/jdk-11.0.2/bin/java /mnt/c/Program Files/Common Files/Oracle/Java/javapath_target_917640/java.exe /usr/share/man/man1/java.1.gz
Not sure where the newest version was installed so that I can make the JAVA_HOME point to that one
openjdk-11-jdk-headless_11.0.11+9-0ubuntu2~20.04_amd64.deb and openjdk-11-jre-headless_11.0.11+9-0ubuntu2~20.04_amd64.deb package shows (by extracting with 7-zip) that OpenJDK 11 will be installed at /usr/lib/jvm/java-11-openjdk-amd64.
This will give you enough information about appending environment variables such as PATH and JAVA_PATH.
And, there may be a path called default-jvm or so, you may use that path accordingly.

How to Set Java Home for Notebook in SageMaker

So it seems that I have Java installed after running the below line in the SageMaker Notebook Terminal:
bash-4.2$ sudo yum install java-1.8.0-openjdk
In the terminal I write the following to confirm:
bash-4.2$ java -version
java version "1.7.0_261" OpenJDK Runtime Environment (amzn-2.6.22.1.83.amzn1-x86_64 u261-b02) OpenJDK 64-Bit Server VM (build 24.261-b02, mixed mode)
In my notebook I have the following Lines of code:
import tabula
tabula.environment_info()
The notebook results in an error with:
java -version` faild. `java` command is not found from this Pythonprocess. Please ensure Java is installed and PATH is set for `java`
Yet, in the terminal I see this:
bash-4.2$ java -version
java version "1.7.0_261" OpenJDK Runtime Environment (amzn-2.6.22.1.83.amzn1-x86_64 u261-b02) OpenJDK 64-Bit Server VM (build 24.261-b02, mixed mode)
I definitely have a java environment. How can I set my notebook to find this?
One approach is to install it from sagemaker notebook via !sudo yum install ...
You can verify the path in the notebook to confirm the linking

What is my real Java version on macOS?

I use macOS Sierra. When I do:
java -version
java version "1.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-468-11M4833)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-468, mixed mode)
it seems that my java version is 1.6.0.
But when I look at System Preferences I find that my version is Java 8 Update 144. I want to use an R package that needs Java >=8.0. What have I done wrong?
The Java found in your command line is the one used to compile when using command line, first, try export JAVA_HOME=$(/usr/libexec/java_home -v 1.8) then check if the correct version shows up using java -version if not reinstall the newest java and run the command again

How can I use JRE 1.8 with Eclipse Neon?

Trying to run Eclipse Neon I'm getting this error:
To open “Eclipse” you need to install the legacy Java SE 6 runtime.
Instead of the legacy JRE, I have already installed JRE 1.8 from Oracle:
➜ /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java -version
java version "1.8.0_121"
Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode)
However, I can also see it is not available in the path:
➜ java -v
No Java runtime present, requesting install.
➜ /usr/libexec/java_home -v 1.8
Unable to find any JVMs matching version "1.8".
No Java runtime present, try --request to install.
➜ ls /Library/Java/JavaVirtualMachines
On macOS you must install the full JDK to get complete Java support. The JRE is not sufficient as it only installs the browser plugins.
The current download for the JDK is here

jmxtrans - Cannot execute

I am trying to get jmxtrans to work yet I get the below on ubuntu 12.04 and using openjdk 7.
/usr/share/jmxtrans# java -version
java version "1.7.0_25"
OpenJDK Runtime Environment (IcedTea 2.3.10) (7u25-2.3.10-1ubuntu0.12.04.2)
OpenJDK 64-Bit Server VM (build 23.7-b01, mixed mode)
/usr/share/jmxtrans# ./jmxtrans.sh start /var/lib/jmxtrans/kafka.json
Cannot execute /usr/lib/jvm/default-java/bin/jps -l!
What does the above mean?
It seems that the jps file can't be found in the /usr/lib/jvm/default-java/bin directory. It is available in the '-devel' packages if you want to install those (yum install java-1.7.0-openjdk-devel, apt-get install openjdk-7-jre-devel). It could also be that your JAVA_HOME is not pointing to the correct place if you have multiple java versions installed.
You should not need it however, regular ps works fine. You can add a variable to your configuration that says export USE_JPS=false. The configuration can be found in /etc/default/jmxtrans.
Check out these issues for more information:
https://github.com/jmxtrans/jmxtrans/issues/89
https://github.com/jmxtrans/jmxtrans/pull/109

Categories

Resources