Oracle’s Java SE 27 macOS installation guide documents JDK bundles under /Library/Java/JavaVirtualMachines. If your Mac says it can’t find java or javac, first check whether a JDK is installed, then check which version and path your terminal is using. Don’t reinstall Java or change system paths until those checks show what is missing.

Who this is for: Students who installed Java 27 but can’t run a Java command in Terminal.
Learners whose Mac has more than one JDK, or whose course project uses a different Java version.
Students using a remote Mac who need to confirm which Java environment their course tools actually use.

Last updated October 27, 2026; checked against the Java SE 27 installation guide and its macOS instructions. Check your course’s required Java version separately; the installed version and the version your course expects may differ.

01

Start with the exact symptom

A “command not found” message is a clue, not a diagnosis. It can mean the shell can’t locate a command, that the required JDK is not installed, or that you are checking one terminal while your editor or course tool uses another environment.

Open the terminal you use for class and run:

java -version
javac -version

The first command checks the Java launcher. The second checks the Java compiler. The official java command reference describes the launcher, and the official javac reference describes the compiler. Record the complete output, including any error. Don’t assume that a successful first command means the compiler is available too.

What you see What it suggests Next low-risk check
java and javac both report that the commands can’t be found The current shell may not see a Java installation, or the required JDK may be absent Check installed JDKs and the shell’s command lookup
java -version works, but javac -version does not The launcher is available, but the compiler may be missing or unavailable through this shell Check whether a JDK is installed; don’t treat this automatically as a PATH problem
Both commands work, but the reported Java version is not the course version Another installed JDK may be selected Compare the active version with the course requirement
Terminal works, but the editor or course tool fails The tools may be using different settings or startup environments Record and compare each tool’s version report
Commands work, but your assignment fails to compile or run The cause may be in the project, editor, or course setup rather than Java installation Test a small program, then check the project’s own instructions

Why does Terminal say Java is missing after installation? It may be checking a different shell or environment from the one where you installed Java. It may also be unable to find the executable, or the expected JDK may not be installed. Check the installed-JDK list and the command output before you choose a fix.

To inspect JDKs that the macOS Java utility can locate, run:

/usr/libexec/java_home -V

For the macOS installation and version-selection details, use the official Java SE 27 macOS instructions linked above. If the command reports installed JDKs but java -version still fails, note both results. They indicate that the JDK list and your shell’s command lookup may not match. Avoid deleting files or changing system directories while you are still identifying the mismatch.

02

Check the JDK and course version

A JDK is the set of tools used to develop Java programs. The java command starts a program; javac compiles Java source files. If you only checked the launcher, you haven’t yet confirmed that you can compile the assignment. The official JDK directory structure documentation describes the installed JDK layout.

How can you check which JDK your Mac is using? Start with java -version and javac -version in the same terminal you use for class. Then compare their output with /usr/libexec/java_home -V. The version text can include more than a feature number: the official version-string reference explains how Java version strings are structured. Compare the full output with your course’s requirement rather than guessing from a partial label.

For a course requiring Java 27, check whether the terminal’s reported Java version matches that requirement. A version string can contain additional information, so don’t treat every number in the output as a different Java release. Confirm what the course actually specifies, then use the documented version format to interpret the result.

A Mac can have multiple JDKs. Oracle’s macOS installation guidance explains how installed versions and the selected default interact. That means “Java is installed” does not necessarily mean “the course terminal is using the Java version I need.” Check the installation guide’s notes on macOS JDK selection before changing environment settings.

If the required JDK appears in the list but the default version is wrong, first check whether your course tool offers a JDK selection setting. That is often a safer place to align a project than changing your whole account’s terminal configuration. Follow the course or editor’s own instructions. The right setting depends on how that tool starts Java.

What if the course and Terminal show different Java versions? Write down the version shown in each place, then check the course instructions and the tool’s official setup guidance. Don’t alter the system default just because one project needs a different version. A project-specific selection may be enough; if the tool cannot select a JDK, follow its documented instructions before changing your shell environment.

03

Separate a missing compiler from a path problem

If java -version works but javac -version fails, don’t immediately add a directory to PATH. The two commands do different jobs, and a working launcher alone does not prove that a complete JDK is available to your current terminal. Check the JDK list and the location the macOS utility reports first.

The JDK layout documented for Java SE 27 includes a bin directory containing command-line tools. The official JDK directory structure reference linked above can help you understand what an installed JDK contains. Use it to compare the expected layout with the installation the system actually reports. Don’t assume that an absent javac is merely a shell lookup issue; the compiler may not be available in the JDK your terminal is using.

If the required JDK is missing from the list, check the official Java download page and the macOS installation instructions for the correct installation method. Confirm that the download and installer match your Mac and course requirements. If a JDK is already listed, pause before reinstalling: your next step is to identify why the terminal is not using it.

If you can locate the JDK’s bin directory, a direct command can help distinguish a command lookup problem from an unavailable installation. Use the actual path reported on your Mac; don’t copy a guessed path into your shell configuration. The official javac documentation linked above explains the compiler command. If running it from the reported JDK location works while javac alone does not, the shell’s lookup is a likely area to investigate. If it does not work, return to the installation and JDK-selection checks.

Don’t run commands with administrator privileges, remove files from system directories, or bypass school device controls to make Java appear. First establish whether a JDK exists and which tool is failing. If the Mac is managed by your school, ask its support team before changing restricted settings.

04

Compare Terminal, editor, and course tools

A student may see one Java version in the system Terminal and a different result inside an editor’s integrated terminal or a course-provided tool. These environments can start differently or have their own JDK settings. A successful check in one window does not prove that every tool is using the same installation.

Use a small comparison record:

  • In the system Terminal, save the output of java -version, javac -version, and /usr/libexec/java_home -V.
  • In the editor or course tool that fails, find its Java version or JDK-location report. Use the tool’s documented way to inspect it.
  • Compare each result with the version your course requires.
  • Note whether the failure is “command not found,” a compilation error, or a runtime error.

Keep the original output before changing any setting. If you later ask a teacher or support person for help, that record is more useful than saying only “Java doesn’t work.” It also helps you undo a change if the course tool starts using the wrong JDK.

If your editor provides a project-level JDK setting, use the editor’s own instructions to select the required installation. Don’t apply a fix from an unrelated tutorial without checking whether your editor uses the same terminal environment. If the system Terminal and editor disagree, look for a documented setting that applies to the editor or the course project first.

Why does Java work in Terminal but not in my editor? The editor may use a different JDK setting or launch environment. Compare its own version report with Terminal, then follow the editor’s instructions for selecting a JDK. If both tools report the expected version but the project still fails, investigate the project configuration instead of reinstalling Java.

05

Verify the repair with a course-style program

Once the command and version checks match your course requirement, verify both compilation and execution. A short program can show whether the compiler and launcher work together. It won’t prove that every assignment is configured correctly, but it helps separate a Java installation problem from a project-specific one.

Create a file named Hello.java:

class Hello {
    public static void main(String[] args) {
        System.out.println("Java is ready");
    }
}

In the same terminal, move to the directory containing the file and run:

javac Hello.java
java Hello

The official compiler documentation describes compiling source files with javac; the launcher reference describes starting a Java program. If the file compiles and prints the expected message, the terminal can compile and run this basic program. If your course requires a different version, check that version again before treating the test as complete.

Close and reopen the terminal you normally use, then repeat the version checks. This catches a fix that only worked in the current session. Next, run the course program using the course’s own instructions. If the small test succeeds but the assignment fails, check the assignment’s project files, build settings, and editor configuration. Don’t keep reinstalling Java when the evidence points to a project issue.

Stop changing your Mac’s settings and ask your instructor or school support team when the device is managed, installation is restricted, or the course setup requires a configuration you cannot access. Also stop treating it as a JDK installation problem if both version checks match the course requirement and only the project fails. At that point, focus on the project or tool that reports the error.

06

Choose the next step based on the evidence

Use the result, not the initial error message, to decide what to do:

  • No JDK appears in the installed list: Check the official download and macOS installation instructions, then install only if the course actually requires that JDK.
  • The required JDK appears, but the terminal selects another version: Check the course tool’s documented JDK-selection method before changing a global default.
  • The launcher works, but the compiler does not: Confirm that the selected installation includes the JDK tools and check the reported JDK location.
  • Terminal and editor disagree: Compare their reports and adjust the relevant tool using its own documentation.
  • The version checks pass, but the assignment fails: Investigate the project, build configuration, or school restrictions instead of removing or reinstalling system files.

The main risk for a beginner is not simply a missing command. It is making a broad change before knowing whether the problem is a missing JDK, a version mismatch, a tool-specific setting, or a project error. Save the command outputs, compare them with the course requirement, and verify any fix with both a small program and the actual course project.

If the checks show that your current computer does not provide an accessible macOS environment, that is a separate problem from a Java command lookup issue. A remote Mac can help when your course genuinely requires macOS, but it is not a universal fix for project errors or school-managed restrictions. You can review VpsMesh’s available Mac options and compare them with the Mac rental pricing details before deciding whether temporary access fits your course. If your local setup already meets the course requirements, keep using it rather than renting a Mac just to fix a shell or project configuration.