I'm trying to use the jmap command on my CentOS server but it keeps telling me that the command was not found even though I have the JDK installed.
Here is the output of command java -version:
java version "1.7.0_25"
OpenJDK Runtime Environment (rhel-2.3.10.4.el6_4-x86_64)
OpenJDK 64-Bit Server VM (build 23.7-b01, mixed mode)
How can I fix this issue?
You should be able to find jmap in the java-1.8.0-openjdk-devel-debug, or java-1.7.0-openjdk-devel-debug, or java-1.6.0-openjdk-devel-debug packages on Redhat/Centos. To install it, run the following as root:
yum install java-1.8.0-openjdk-devel-debug
For completeness, here's the command to check which packages include jmap:
yum whatprovides '*/jmap'
Here's a sample output:
1:java-1.6.0-openjdk-devel-1.6.0.37-1.13.9.4.el7_1.x86_64 : OpenJDK Development Environment
Repo : updates
Matched from:
Filename : /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.37.x86_64/bin/jmap
1:java-1.7.0-openjdk-devel-1.7.0.91-2.6.2.3.el7.x86_64 : OpenJDK Development Environment
Repo : base
Matched from:
Filename : /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.91-2.6.2.3.el7.x86_64/bin/jmap
1:java-1.8.0-openjdk-devel-1.8.0.65-3.b17.el7.x86_64 : OpenJDK Development Environment
Repo : base
Matched from:
Filename : /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.65-3.b17.el7.x86_64/bin/jmap
1:java-1.8.0-openjdk-devel-debug-1.8.0.65-3.b17.el7.x86_64 : OpenJDK Development Environment with full debug on
Repo : base
Matched from:
Filename : /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.65-3.b17.el7.x86_64-debug/bin/jmap
1:java-1.8.0-openjdk-devel-debug-1.8.0.65-3.b17.el7.x86_64 : OpenJDK Development Environment with full debug on
Repo : #base
Matched from:
Filename : /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.65-3.b17.el7.x86_64-debug/bin/jmap
The following worked for me:
sudo apt-get install openjdk-8-jdk openjdk-8-dbg
My situation was a little strange (running inside the openjdk:8-jre Docker image), but this combination worked
cat /etc/debian_version # 8.6
apt install -t jessie-backports openjdk-8-jre-headless ca-certificates-java
apt-get install -f -y openjdk-8-jdk-headless
apt-get install -f -y openjdk-8-dbg
the java path must be in the "PATH" systemproperty.
$JAVA_HOME/bin
it doesn't come default with JRE -- you should be able to install it with below command
yum install java-1.8.0-openjdk-devel-debug
for Debian "buster" - 10.3 -
cat /etc/debian_version # 10.3
echo "deb http://ftp.us.debian.org/debian sid main" > /etc/apt/sources.list.d/buster.list
apt-get update && apt-get install -f -y openjdk-8-jdk-headless openjdk-8-dbg
OpenJDK on centos doesn't include the jmap utility. test on another platform or use the jhat java_pid1234.hprof command to examine the dump after the fact on another platform.
jhat can be slow to run on large dumps and even run out of memory! I use jhat -port 7000 -J-mx2048m java_pid1234.hprof so you'll need plenty of ram on your computer.
I found that on my system (elasticsearch container) it is excluded:
$ grep exclude /etc/yum.conf
exclude=java-1.8.0-openjdk*
If I comment it out then I can see and install this package with yum install ...
Related
I'm new to Raspberry-Pi & Linux and I wanted to code up a Minecraft server using PaperMC, but when I ran the server I got a warning saying that Java-11 would no longer be supported in future builds, so I thought it would be easy enough to upgrade to Java-16. I have not found documentation regarding this topic specifically which has led to using parts of differing tutorials, and I think I made a few mistakes. To start, I purged the old Java-11 version like so:
sudo -i
apt-get purge openjdk*
apt-get purge java11*
apt-get autoremove
Then I moved to the jvm directory and installed Java-16 from AdpotOpenJDK:
cd /usr/lib/jvm
wget https://github.com/AdoptOpenJDK/openjdk16-binaries/releases/download/jdk-16.0.1%2B9/OpenJDK16U-jre_aarch64_linux_hotspot_16.0.1_9.tar.gz
tar xzf OpenJDK16U-jre_aarch64_linux_hotspot_16.0.1_9.tar.gz
export PATH=$PWD/jdk-16.0.1+9-jre/bin:$PATH
java -version
openjdk version "16.0.1" 2021-04-20
OpenJDK Runtime Environment AdoptOpenJDK-16.0.1+9 (build 16.0.1+9)
OpenJDK 64-Bit Server VM AdoptOpenJDK-16.0.1+9 (build 16.0.1+9, mixed mode, sharing)
This export PATH command seems to be temporary, when I logout of sudo or exit the command window, and then check java -version again I get that the java command is not found. If I try setting JAVA_HOME & PATH:
export JAVA_HOME="/usr/lib/jvm/jdk-16.0.1+9-jre"
export PATH=$PATH:$JAVA_HOME/bin
The result is also temporary. Why can't I set this Java-16 as the default? Do I need to make a script that runs these commands on startup?
Here is a way to install it permanently using apt. Link to the information
https://paper.readthedocs.io/en/latest/java-update/index.html#debian-ubuntu
$ sudo apt update
$ sudo apt install apt-transport-https software-properties-common gnupg wget
$ wget -qO - https://adoptopenjdk.jfrog.io/adoptopenjdk/api/gpg/key/public | sudo apt-key add -
$ sudo add-apt-repository https://adoptopenjdk.jfrog.io/adoptopenjdk/deb/
$ sudo apt update
$ sudo apt install adoptopenjdk-16-hotspot
Does anybody know how I can install Java 13.0.1 on a RaspberryPi 4?
Because I use [Java 13.0.1]1 on my WindowsEngine and so I wrote and exported my JavaApplication with Java 13.0.1 but the RaspberryPi only supports a licensed Version of Java 11.0.5 which is not available for free.
Surprised nobody has posted about this yet; you can totally install recent versions of Java on Raspbian.
In this example, I'll be using an AdoptOpenJDK OpenJDK build to install Java 14 on Raspbian Stretch.
# 1) Download the armhf jdk14 binary
wget 'https://adoptopenjdk.jfrog.io/adoptopenjdk/deb/pool/main/a/adoptopenjdk-14-hotspot/adoptopenjdk-14-hotspot_14.0.0+36-2_armhf.deb'
# 2) now install it, and don't worry if it spits out a ton of errors, this is normal
sudo dpkg -i 'adoptopenjdk-14-hotspot_14.0.0+36-2_armhf.deb'
# 3) install missing dependencies
sudo apt-get install -f
And that's it! Running java -version now yields:
$ java -version
openjdk version "14" 2020-03-17
OpenJDK Runtime Environment AdoptOpenJDK (build 14+36)
OpenJDK Server VM AdoptOpenJDK (build 14+36, mixed mode, sharing)
Ok,
I decided to download Java 11.0.5 to my windows engine and build the JavaProjects as a Java 11.0.5 Application.
Paying for any version of Java is getting ripped off: don't do it ever, unless you need to comply with licensing for a professional project (or something).
There isn't currently something you can install from apt-get, but Bell-SW has Java 13 packages for ARMv7 (you just have to scroll down) and they have instructions for how to install.
https://bell-sw.com/pages/java-13.0.2/
For free.
or just use the AdoptOpenJDK repos:
echo "deb https://adoptopenjdk.jfrog.io/adoptopenjdk/deb buster main" | sudo tee /etc/apt/sources.list.d/adoptopenjdk.list
wget -qO - https://adoptopenjdk.jfrog.io/adoptopenjdk/api/gpg/key/public | sudo apt-key add -
sudo apt-get update
apt-cache search adoptopenjdk
sudo apt-get install adoptopenjdk-15-hotspot
Those are the condensed instructions for Linux RPM and DEB installer packages
apt-cache search adoptopenjdk - shows a list of packages (versions) available (incl. v8 & v11)
If you want/need to build JDK, you can start with this gist.
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 have a Ubuntu host on which i have installed OpenJDK 10 and Gloud SDK using APT. When i try to install 'google-cloud-sdk-datastore-emulator', i get the error shown below.
I found a thread on GCP GitHub that talks about this but its closed. Here - https://github.com/GoogleCloudPlatform/cloud-sdk-docker/issues/144
Anyone else having this issue?
Error -
# apt install google-cloud-sdk-datastore-emulator
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
google-cloud-sdk-datastore-emulator : Depends: openjdk-8-jdk but it is not installable
E: Unable to correct problems, you have held broken packages.
My Environment -
OS -
DISTRIB_RELEASE=18.04
DISTRIB_CODENAME=bionic
DISTRIB_DESCRIPTION="Ubuntu 18.04.2 LTS"
NAME="Ubuntu"
VERSION="18.04.2 LTS (Bionic Beaver)"
OpenJDK -
#java -version
openjdk version "10.0.2" 2018-07-17
OpenJDK Runtime Environment (build 10.0.2+13-Ubuntu-1ubuntu0.18.04.4)
OpenJDK 64-Bit Server VM (build 10.0.2+13-Ubuntu-1ubuntu0.18.04.4, mixed mode)
#javac -version
javac 10.0.2
#which java
/usr/bin/java
Gcloud sdk -
# gcloud -v
Google Cloud SDK 234.0.0
alpha 2019.02.08
beta 2019.02.08
bq 2.0.41
core 2019.02.08
gsutil 4.36
kubectl 2019.02.08
There's some issue with our debian package dependancy config.
Although if you install the emulator via gcloud command it should work:
gcloud components install cloud-datastore-emulator
(https://cloud.google.com/sdk/gcloud/reference/components/install)
Note the components manager doesn't work if sdk is insalled from other package managers. In this case you can remove it and install following the suggestion here: stackoverflow.com/questions/42697026
If for some other reason you do have to install via apt-get, https://serverfault.com/questions/250224 should help, basically avoid install openjdk by:
apt-get install google-cloud-sdk-datastore-emulator openjdk-8-jdk-
Note there's a "-" after the openjdk-8-jdk
Or you can follow the steps in the same thread to update package dependancy.
My solution involved using equivs to create a fake openjdk-8-jdk package (of course you need to make sure you have another JDK).
apt-get install equivs
equivs-control openjdk-8-jdk
vim openjdk-8-jdk # especially change the package name, but I also used 11.0.0 as a version (although it's probably not needed)
equivs-build openjdk-8-jdk
dpkg -i openjdk-8-jdk*.deb
I tried to install netbeans 'netbeans-7.2.1-ml-linux.sh' on my ubuntu12.04
But when i am executing this .sh file i am gettig the exception given below.
Configuring the installer...
Searching for JVM on the system...
Extracting installation data...
Running the installer wizard...
Can`t initialize UI
Running in headless mode
Exception: java.awt.HeadlessException thrown from the UncaughtExceptionHandler in thread "main"
You need to install Java Runtime Environment
sudo aptitude install default-jre
Refer to this answer:
netbeans installation error: can't initialize ui running in headless mode
Worked for me. For some reason, with OpenJDK the installer was unable to open a GUI.
The Problem is the support of openJDK for the UI.
The solution is installing Oracle JDK, open your terminal and write the following commands:
sudo apt-get remove openjdk*
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer
sudo apt-get install oracle-java7-set-default
after that reinstall netbeans.
You're missing a X-Server for installation (java.awt.HeadlessException). The installation script needs a UI.
For some reason the sh installer does not work with the openJDK 7.
Quick fix to install is to change back to JDK 6.
run:
sudo update-alternatives --config java
(select java 6)
sh netbeans-7.2.1-ml-linux.sh
the installer should run and then just switch back to the java 7 JDK with update-alternatives.
In my case, I had openjdk installed, where /usr/bin/java was point to the installed openjdk.
I solved it by installing the Oracle JDK 7, from a tar.gz file. Extract the tar ball to a location say your $HOME directory.
After that
I modified the .bashrc file and modified the PATH variable to
PATH=$HOME/jdk1.7/bin/:$PATH export PATH
Remember the path to your jdk/bin should be appended to PATH, as as result the system will find the java executable in your path rather than picking the installed openjdk.
Note: I chose not to uninstall installed openjdk, as most of my Libreoffice and other installed applications were depending on it.
First you have to update
sudo apt-get update
Then default java
sudo apt-get install -f default-jre
sudo apt-get install -f default-jdk
And should be done.
This is what fixed it for me:
I installed the Java JDK. In this case:
sudo aptitude install openjdk-8-jdk
Here's the kicker: I made sure that my Home and Path variables were set properly. Again, in my case:
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk
export PATH=$PATH:/usr/lib/jvm/java-8-openjdk/bin
My initial issue was not having the JDK installed. It was then not having the environment variables properly set. If they aren't properly set, the installer won't launch. Simple as that.