2

When I do which java I get the following output:

which java
/dir/java/bin/java

I have already uninstalled java rpm using the following

`rpm -qa | grep -i java`
rpm -e rpm-name

Still java is not installed and which java brings up /dir/java/bin/java

2
  • 1
    That sounds like it was installed outside of rpm (or yum/dnf), so it's not in the database. Commented May 31, 2019 at 0:09
  • How to remove java in such a scenario?
    – meallhour
    Commented May 31, 2019 at 0:16

3 Answers 3

4

Apparently Java may have been installed outside of rpm package management.

In that case, you could just do a mv /dir/java /dir/java.to-be-removed, then verify that nothing essential gets broken by this.

If all seems OK, then remove any references to /dir/java/bin in system-wide PATH and MANPATH settings (check /etc/environment, /etc/profile, and the files in /etc/profile.d directory if it exists) , delete any system-wide JAVA_HOME environment variable settings, and finally remove the /dir/java.to-be-removed directory altogether.

You might also check that /usr/local/bin directory doesn't contain any now-broken symbolic links pointing to the various tools within /dir/java/bin.

1

try to find destination dirs from below commands.

which java

Or/and

/usr/sbin/alternatives --display java

One you find out delete those folder itself.

Since you already tried rpm way I am not adding. But be aware some other software which require java may not work after complete removal.

1

Adding to the other answers; if you don't know whether a file belongs to an rpm or not, you can use:

rpm -qf /path/to/file

Which tells you to what rpm that file belongs.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .