This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Linux / UNIX and the fly likes Uninstalling java on linux Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "Uninstalling java on linux" Watch "Uninstalling java on linux" New topic
Author

Uninstalling java on linux

Sunil Kumar
Greenhorn

Joined: Aug 15, 2005
Posts: 14
I have install java on linux (Red Hat), now i want to uninstall - kindly suggest
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34

Depends how you installed -- with a tar file, or an RPM. If it's an RPM, then

rpm -e packagename

will do it. If it was a tar file, then just rm -rf the jdkXXXX directory.


[Jess in Action][AskingGoodQuestions]
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15950
    
  19

I'm not sure if "-e" is the right switch. But "--erase" works.

For brute-force uninstalls, you just "rm -rf /usr/java/jdkXXXXX", assuming you had it installed in the generally-accepted place for Linux using untar/unzip. However, don't do this for RPM installs, since that will leave disconnected references in the RPM database, which is untidy.

Since (thank goodness) there's nothing like the Windows Registry to complicate things in Linux (that **** in gnome doesn't apply here), there's nothing else to worry about.

If people have been running java applications, local accounts may have created hidden java directories with app preferences in them. You can delete them or leave them as you like.


Customer surveys are for companies who didn't pay proper attention to begin with.
Sunil Kumar
Greenhorn

Joined: Aug 15, 2005
Posts: 14
I tried and it works, but the next issue is it doesn't removes jre at the same time.Still java -version gives me the "java version "1.3.1" installed on my system

So, can you suggest how to remove/uninstall the jre as well, i tried "rpm -e jre-1.3.1-fcs"
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15950
    
  19

I don't normally install a separate JRE, since there's one embedded in the JDK.

You can inventory RPM's via "rpm -qa | grep -i java" for the names of any remaining Java packages. If you don't find any, just delete the JRE directory. Like the JDK, there's no magic.

Although I'm talking Sun's Java here. I forgot about that nasty gcj stuff that come in later Fedora and RHEL releases. It's tied into the Preferences system, which is a nasty little mess as far as I'm concerned, even if it does offer java choices on a per-user basis (So does JAVA_HOME in most apps with a lot less fuss, though).

If you're trying to rip out the gcj stuff, I can only recommend you google out a list of the packages. And be prepared to discover that OpenOffice or Evolution or something requires one or more of them so you can't rip them out after all.
hemalata bari
Greenhorn

Joined: Feb 14, 2006
Posts: 1
Originally posted by Sunil Kumar:
I tried and it works, but the next issue is it doesn't removes jre at the same time.Still java -version gives me the "java version "1.3.1" installed on my system

So, can you suggest how to remove/uninstall the jre as well, i tried "rpm -e jre-1.3.1-fcs"
Bharat Ruparel
Ranch Hand

Joined: Jul 30, 2003
Posts: 493
Hello Sunil,
Just delete the symbolic link in /usr/java which is pointing back to the alternate stuff and set $JAVA_HOME when you install a fresh copy to point to its location. That symbolic link is messing you up. To determine its location, issue a "which java" command, this will point to the link and then follow the link to /etc/alternate. This symbolic link is a whole lot more trouble that worth it. Just get rid of it.
Regards,
Bharat


SCJP,SCJD,SCWCD,SCBCD,SCDJWS,SCEA
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5811
    
    7

Ma Yao,
Your post was moved to a new topic.


JBoss In Action
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Uninstalling java on linux
 
Similar Threads
How close to real exam?
tomcat and java_home
Classpath
How close to real exam?
which Linux Certification?