How to solve the java home showing as /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home in MacOS Big Sur?


If we install the Java in MacOs Big Sur after downloading the JDK from Oracle, i am unable to compile the java program using javac.

  Install JDK 8: https://www.oracle.com/java/technologies/javase/javase-jdk8-downloads.html        Java SE Development Kit 8u281

When i check the java -version , it is showing as below 

java version "1.8.0_311"

Java(TM) SE Runtime Environment (build 1.8.0_311-b11)

Java HotSpot(TM) 64-Bit Server VM (build 25.311-b11, mixed mode)


After that when i check the java home using /usr/libexec/java_home -V 


it is the showing it as /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home



Solution:


Use the below commands to remove the folder

sudo rm -fr /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin 
sudo rm -fr /Library/PreferencePanes/JavaControlPanel.prefpane Then use this to check the java home /usr/libexec/java_home -V 

jayabalan@Saravanakumars-MacBook-Air ~ % /usr/libexec/java_home -V

Matching Java Virtual Machines (1):

    1.8.0_311 (x86_64) "Oracle Corporation" - "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_311.jdk/Contents/Home

/Library/Java/JavaVirtualMachines/jdk1.8.0_311.jdk/Contents/Home

jayabalan@Saravanakumars-MacBook-Air ~ % 


If you see the above path, then java home is set properly and java programs will work



Comments

Popular posts from this blog

How to run Powershell script on mac?

How to install Microsoft Azure Data Studio so you can manage SQL Server straight from your Mac!

How to fix the four common startup issue with MacBook