Avatar ·

How to install Java 8 (JDK 8) on Mac: step-by-step guide

Hello everyone! I'm a beginner Java developer who recently switched to Mac (macOS Ventura). I need to install Java 8 for an old study project. The problem is that I downloaded the latest version of Java (21) from the official website, but my project doesn't compile on it — I get errors about deprecated APIs and unsupported flags.\n\nHere's an example of the code I'm trying to run:\n\n```java\npublic class LegacyApp {\n public static void main(String[] args) {\n // Using deprecated API from Java 8\n java.util.Date date = new java.util.Date();\n System.out.println("Date: " + date);\n \n // Trying to use PermGen (only worked in Java 8)\n System.gc();\n }\n}\n```\n\nWhen compiling via terminal with the command `javac LegacyApp.java`, I get warnings,