Uninstalling older java version from mac os x el capitan - java

I have installed jdk 8 update 92 on my macbook which had jdk 1.6.0 installed in it. Now I want to uninstall the java sdk 1.6.0 files from location "/System/Library/Frameworks/JavaVM.framework/Versions" but when I try to do so a error gets prompt saying " “1.6.0” can’t be modified or deleted because it’s required by OS X.".
So please tell me how to remove these files.

Try to change the JAVA_HOME, you can have installed both of jdk's but it is important that which one is selected as your JAVA_HOME. Once you change it, there is no need to delete the unused ones and they can be there without deleting them.
Here you can find a good tutorial to do so.

https://www.java.com/en/download/help/mac_uninstall_java.xml worked for me:
sudo rm -fr /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin
sudo rm -fr /Library/PreferencePanes/JavaControlPanel.prefpane

Related

Revert to an older version of Java

I need to have Java SE 6 installed on my Mac to run logisim. However, I have a newer version of java installed so logisim won't run. How can I get this newer version off of my Mac so i can download the older one? I have tried the following commands given on the Java/oracle website and am still not having any luck.
sudo rm -fr /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin
sudo rm -fr /Library/PreferencePanes/JavaControlPanel.prefpane
You don't need to uninstall the new java version. You can even use multiple java versions on your mac and switch between them, look at this:
https://www.jenv.be/
No need to uninstall current version of java just follow the below link according to your platform to install older version of java :
windows : http://www.catgovind.com/java/how-to-install-specific-version-of-java-on-your-machine
Linux : https://dev.to/thegroo/install-and-manage-multiple-java-versions-on-linux-using-alternatives-5e93

How to uninstall JDK on Mac OS?

Folks - I am facing challenges while trying to uninstall JDK from my MAC (macOS High Sierra Version 10.13.4 - 17E199). I have two JDK instances installed and I want to uninstall both of them.
I am following the steps listed on this page: https://docs.oracle.com/javase/8/docs/technotes/guides/install/mac_jdk.html
I am trying to run this command in the /Library/Java/JavaVirtualMachines directory which throws an error that I do not have the permission.
rm -rf jdk1.8.0_06.jdk
I am the administrator of the machine and am not sure what more permission do I need. I have made attempts as the admistrator and as the root user with no success.
Please share your thoughts on this.
From the official Oracle manual.
Navigate to /Library/Java/JavaVirtualMachines and remove the directory whose name matches the following format:
/Library/Java/JavaVirtualMachines/jdkmajor.minor.macro[_update].jdk
For example, to uninstall 8u6:
%rm -rf jdk1.8.0_06.jdk
Do not attempt to uninstall Java by removing the Java tools from /usr/bin. This directory is part of the system software and any changes will be reset by Apple the next time you perform an update of the OS.
To remove system files you need to add sudo before rm -rf command.
For MacOS - Big Sur | Using Terminal
I was able to remove OpenJDK as per information provided in below link.
Site Link
If you want to remove JDK from mac you can use the following command:
cd /Library/Java/JavaVirtualMachines/
and then use sudo to remove the jdk because you need root permissions to delete jdk from /Library/Java/JavaVirtualMachines/.
/Library/Java/JavaVirtualMachines/ is owned by root.
sudo rm -rf jdk1.8.0_06.jdk
https://installvirtual.com/uninstall-java-8-mac-os-x/
This answer is correct for JDK 8, but it would be nice to point out that Oracle provides different instructions for each release of the JDK. The link structure changes slightly for some versions, but generally you can go to https://docs.oracle.com/en/java/javase, select your JDK release, and look for the "Install Guide" link in the Overview group.
For example:
JDK 9
JDK 10
JDK 11
Also, the files in /usr/bin are not part of the JDK, so you don't really want to remove them. On a system that has never had the JDK installed:
$ ls -l /usr/bin/java
lrwxr-xr-x 1 root wheel 74 Sep 27 17:08 /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java
$ java -version
No Java runtime present, requesting install.
Apparently macOS includes a baseline version of the JDK, where each command is a stub that just prints this message and pops up a dialog in the GUI.

How do I install an earlier version of Java SDK on OSX

I have the Java 1.8.0_45 SDK installed on OSX Yosemite (10.10.4), but because of a bug in this release I need to go back to 1.8.0_25
I have downloaded and installed the earlier version (1.8.0_25) but even after a reboot java -versionstill shows 1.8.0_45.
I don't really understand where Java resides on OSX, but how can I get my system back so it uses 1.8.0_25
Try and add this to your ~/.bashrc
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_75.jdk/Contents/Home
You can have multiple JRE/JDK's installed, by changing this path, you can specify which one you use each time you open a new shell.
Here is what I use in my .bashrc
JAVA_VERSION=7
JAVA_7_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_75.jdk/Contents/Home
JAVA_8_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_40.jdk/Contents/Home
tmp="JAVA_${JAVA_VERSION}_HOME"
export JAVA_HOME=${!tmp}
export PATH=${!j}/bin:$PATH
Here, you can simply change the 7 to an 8.
This will change the JAVA_HOME, and append the bin directory to your path for general use from the command line.
note you may beed to change your java home's according to the specific release versions installed on your machine.
Ah found it, suprisingly easy:
macbook:JavaVirtualMachines paul$ cd /Library/Java/JavaVirtualMachines
macbook:JavaVirtualMachines paul$ ls
jdk1.7.0_40.jdk jdk1.7.0_45.jdk jdk1.8.0.jdk jdk1.8.0_05.jdk jdk1.8.0_20.jdk jdk1.8.0_25.jdk jdk1.8.0_45.jdk
macbook:JavaVirtualMachines paul$ sudo rm -fr jdk1.8.0_45

Eclipse can't find Java, Java not installed

I was following an online tutorial on how to delete JVM 6 and install JVM 7 to be able to run eclipse on my Mac running OS X 10.9.2. First I installed the latest JDK.
I was instructed to type the following commands to delete JVM 6.
sudo rm -rf /System/Library/Java/JavaVirtualMachines/
sudo rm /private/var/db/receipts/com.apple.pkg.JavaForMacOSX*
sudo emacs /Library/Receipts/InstallHistory.plist
Then, I set the symlinks for java 7, with these commands.
sudo rm /usr/bin/java
sudo ln -s /Library/Java/JavaVirtualMachines/jdk1.7.0_60.jdk/Contents/Home/bin/java /usr/bin/java
This should be it. Now my computer does not have any version of Java on it:
the command "java -version" responds with "java: command not found"
I also cannot direct to the folder with cd Library/Java responding with "Folder does not exist", however I can browse to that folder manually.
Can someone please assist me in getting Java 7 running on my computer so I can use eclipse.
Any help much appreciated and keep in mind I'm a Mac newb.
this is the tutorial i followed:
http://www.cc.gatech.edu/~simpkins/teaching/gatech/cs2340/guides/java7-macosx.html
Did you change the PATH variable to point to the newer version?
/usr/libexec/java_home is the starting point for switching java versions on the command line. Check out this post to understand how to handle different java versions on the Mac.
I think that the folder still exists but executables didn't existe because anh version of Java is installed.
Normally you have just to download the jdk or jre on oracle web site and run the package downloaded

Ant needs tools.jar and unable to find it

I am putting together a dev environment for a Java program and after the first try of my Ant build scripts I got this error:
Unable to locate tools.jar. Expected to find it in /usr/lib/jvm/java-6-openjdk/lib/tools.jar
While the path to the jdk is correct, the tools.jar really wasn't there. Is it actually supposed to be there or did I get some config/installation thing wrong?
It seems like you can have Java installed in /usr/lib/jvm/java-6-openjdk but only have the JRE, not the JDK. This fixed it for me:
sudo apt-get install openjdk-6-jdk
Note: On CentOS / RHEL installing java-1.x.0-openjdk will not be enough. Also install java-1.x.0-openjdk-devel.
It's there on my machine. I'm running Sun JDK 1.6.0_21 on Windows XP SP3.
Are you sure you have the JDK? Is it possible that you only have the JRE?
On Debian, after installing Ant with apt-get install ant, I've encountered the same error when running it:
Unable to locate tools.jar. Expected to find it in /usr/lib/jvm/java-6-openjdk-amd64/lib/tools.jar
Indeed, there's no mention of any tools.jar anywhere in /usr/lib, although /usr/lib/jvm/java-6-openjdk-amd64 itself does exist.
https://packages.debian.org/search?searchon=contents&keywords=java-6-openjdk-amd64%2Flib%2Ftools.jar
As per the search above, java-6-openjdk-amd64/lib/tools.jar appears to be part of openjdk-6-jdk, which indeed didn't get installed with ant (since it's only marked as suggested (https://packages.debian.org/wheezy/ant)).
apt-get install openjdk-6-jdk
apt install defalut-jdk # this doesn't contain some file, like tools.jar...
apt install openjdk-8-jdk # this contains all files.
On Ubuntu I've just need to install JDK
sudo apt-get install openjdk-7-jdk
..and you can always search for all available versions with
$ sudo apt-cache search openjdk | grep ^openjdk
From the website https://openjdk.java.net/install/ we can read
The openjdk-7-jre package contains just the Java Runtime Environment. If you want to develop Java programs then install the openjdk-7-jdk package.
Try the following:
% sudo apt-get install sun-java6-jdk
% sudo update-alternatives --config java
select the option that has the path
/usr/lib/jvm/java-6-sun/jre/bin/java
Worked for me on an ubuntu 10.4
u can try to put your JAVA_HOME also, as follows:
% sudo export JAVA_HOME=$(readlink -f /usr/bin/javac | sed "s:/bin/javac::")
Installing the jdk-6u45-linux-x64.bin (from the oracle.com site) via unzip does not result in a tools.jar. I guess that file is created by the "make-jpkg" script. Once I did that, and installed the resulting .deb file, everything was fine.
I really hate oracle's lawyers.
Even if you have jdk installed, you'll need to redirect JAVA_HOME to point to it.
Here's one weird trick you can put into your .profile to set JAVA HOME properly, no matter which java you have:
export JAVA_HOME=$(dirname $(dirname $(readlink -e /usr/bin/java)))
# Test for jdk installed above jre
if [ -x $JAVA_HOME/../bin/java ]; then export JAVA_HOME=$(dirname $JAVA_HOME); fi
On Ubuntu I've fixed this problem by installing package
openjdk-7-jre-lib
tools.jar appeared after that.
(I know this is an old post, but comment in hope that it will be helpful for somebody lurking for answer like I was today.)

Categories

Resources