How to change the default JRE in tomcat through parellel plesk - java

I have a parallel plesk console. Tomcat version istalled is 7. and JRE also 1.7. But some application is not working. So i need to change JRE 7 to JRE 8.
How it is possible through plesk console?

you need to uninstall JDK 7 and re-install JDK8.
for uninstalling java you can refer below links :
http://www.2daygeek.com/remove-uninstall-oracle-java-openjdk-on-ubuntu-centos-debian-fedora-mint-rhel-opensuse/#
https://askubuntu.com/questions/84483/how-to-completely-uninstall-java
Install JAVA 8
First of all, you need to add webupd8team Java PPA repository in your system. After that install, Oracle Java 8 using following a set of commands.
$ sudo add-apt-repository ppa:webupd8team/java
$ sudo apt-get update
$ sudo apt-get install oracle-java8-installer
Verify Installed Java Version
After successfully installing Oracle Java using above step verify installed version using the following command.
mayank#tecadmin:~$ java -version
java version "1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)
Configuring Java Environment
Also, install Java configuration package. It seems like below package is already installed with latest operating systems during installation of JAVA packages. But you can still make sure by running below command.
$ sudo apt-get install oracle-java8-set-default
Now edit /etc/environment configuration file and add following entries to set JAVA_HOME and JRE_HOME environment variables.
JAVA_HOME=/usr/lib/jvm/java-8-oracle
JRE_HOME=/usr/lib/jvm/java-8-oracle/jre

Related

centos using older version of 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.

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.

CentOS7: Setting default JAVA as Oracle JDK and not openJDK

I have a machine with CentOS7. The default Java is
openjdk version "1.8.0_131"
OpenJDK Runtime Environment (build 1.8.0_131-b12)
OpenJDK 64-Bit Server VM (build 25.131-b12, mixed mode)
I want to change this to
java version "1.8.0_51"
Java(TM) SE Runtime Environment (build 1.8.0_51-b16)
Java HotSpot(TM) 64-Bit Server VM (build 25.51-b03, mixed mode)
To do so, I have so far followed the steps as given below.
Download jdk-8u212-linux-x64.tar.gz file
I could not untar the above using tar -zxvf jdk-8u212-linux64.tar.gzto a specified directory. Hence I used 7-zip and the extracted the JDK1.8.0_212 folder and copied the same to /usr/lib/jvm
Then I made the necessary changes at /etc/profile. There I set the JAVA_HOME as export JAVA_HOME=/usr/lib/jvm/jdk1.8.0_212 and followed by export PATH=$PATH:$JAVA_HOME\bin
However, when I typed update-alternatives --config java I could not see jdk1.8.0_212/bin/java as path. Instead I saw only openjdk options.
My question is: How to set my default Java as Oracle Java as mentioned above. The reason I am asking is I have found that sqljdbc4-x.jar is not compatible with openJDK. I have already raised a query here
A simple approach would be to first remove Open JDK using purge then install Oracle jdk..if u are using apt-get it would automatically set the necessary Java Paths.
Here is what I meant.
yum list java*
sudo yum -y remove java*
java -version
cd
mkdir tmp
cd tmp
curl -u uftp:uftp ftp://192.168.2.115/path/developer/jdk-8u151-linux-x64.tar.gz -o jdk-8u151-linux-x64.tar.gz
tar zxvf jdk-8u151-linux-x64.tar.gz
sudo mv jdk1.8.0_151 /usr/share/
sudo vim /etc/profile
#add
export JAVA_HOME=/usr/share/jdk1.8.0_151
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
source /etc/profile
java -version
which java
cheers.

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