How to remove/install Java on linux?

Title looks like a very generic one but this post is mainly related to installation of Java with required/favorable version and removing non-required version. When you install any distribution of linux is installs few more things along with main linux installation.

It generally installs some version of java which may not be required version for running your application. So you need to remove it and then install the required version.

Let me take two cases here:

1. You just installed linux on your machine server and it has other version of java

It depends on what distribution of linux you are installing but I noticed that Fedora installs GNU package for java and if you try to figure out java package using following command, you give output like below:

#rpm -q jdk
package jdk is not installed

So check following if you are working with Fedora:

Confirm that Java is installed by OS:
#java
Usage: gij[-options] class [args...]
(to execute a class)

** gij represents GNU interpreter for Java and libgcj represents library of GNU compiler for Java

Use rpm -q (query) for exact name of package:
#rpm -q libgcj
libgcj-x.x.x-xx.xxx_xx

Use rpm -e (erase) for removing the package:
#rpm -e libgcj-x.x.x-xx.xxx_xx

2. Machine is older than the first case and it has some other version which is not suitable for your application.

Search for keyword ‘jdk’
#rpm -q jdk
jdk-x.x.x-xxx

Remove it if not compatible:
#rpm -q jdk-x.x.x-xxx

Most Commented Posts

If you enjoyed this post, please consider to leave a comment or subscribe to the feed and get future articles delivered to your feed reader.

Comments

bhaut hi bura hai

Leave a comment

(required)

(required)