Contents

Install JDK-7 on Mac M1

Contents


P.S. - The JDK 7 version available is for x64 architecture. - It will be running via Rosetta 2 (Rosetta 2 enables a Mac with Apple silicon to use apps built for a Mac with an Intel processor.)

### Download & Install JDK 7 from Oracle website

Oracle JDK 7 Download page

Find and download the package under the list having name as “Mac OS X x64”. In my case, the file name is “jdk-7u80-macosx-x64.dmg”.

Install it by double-clicking on it and going through the installation process normally.



### Verify the installation Open a new shell, and verify the installation by ```powershell javac -version ```

It should output something like

$ javac -version
javac 1.7.0_80



### Set JAVA_HOME variable for JDK-7 on MacOS

Run the below command to lookup the location for the JDKs installed on the system.

1
/usr/libexec/java_home -V | grep jdk

The output is something like

$ /usr/libexec/java_home -V | grep jdk
Matching Java Virtual Machines (2):
   1.8.301.09 (x86_64) “Oracle Corporation” - “Java” /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home
   1.7.0_80 (x86_64) “Oracle Corporation” - “Java SE 7” /Library/Java/JavaVirtualMachines/jdk1.7.0_80.jdk/Contents/Home


Copy the path as per your result. In my case I have copied the path for Java SE 7 i.e. /Library/Java/JavaVirtualMachines/jdk1.7.0_80.jdk/Contents/Home

Add the path to your ~/.zshrc

1
2
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_80.jdk/Contents/Home
export PATH=$JAVA_HOME/bin:$PATH


Hope this helps!